Recent

TOC class

TOC

TOC Class.

Namespace: WebberZone\Knowledge_Base\Frontend
Since: 3.0.0
Source: includes/frontend/class-toc.php line 21

Methods

__construct()

Constructor.

Since: 3.0.0
Line: 44

public function __construct(  );

inject_anchors()

Filter callback: add anchor IDs to headings in article content.

Only runs when a non-inline TOC consumer is active (floating TOC option, sidebar widget, or block in the post content). The inline TOC manages its own anchor injection via inject_toc(). Preserves any existing heading id attributes added by third-party TOC blocks (e.g. Kadence, Stackable) so no duplicate anchors are introduced.

Since: 3.0.1
Line: 65

public function inject_anchors( string $content ): string;
TypeNameDescription
string$contentPost content.

Returns: string — Content with anchor IDs added to headings, or original content unchanged.

inject_toc()

Filter callback: prepend TOC to article content.

Since: 3.0.0
Line: 120

public function inject_toc( string $content ): string;
TypeNameDescription
string$contentPost content.

Returns: string — Content with TOC prepended, or original content unchanged.

process_content() static

Parse headings in content, add anchor IDs, and build TOC HTML.

Since: 3.0.0
Line: 155

static public function process_content( string $content, array $args = ... ): array;
TypeNameDescription
string$contentPost content.
array$args{

Returns: array — {