Recent

Section_Tree class Pro only

Section_Tree

Section Tree class.

Namespace: WebberZone\Knowledge_Base\Pro\Frontend
Since: 3.1.0
Source: includes/frontend/class-section-tree.php line 34

Methods

enqueue_scripts() static

Enqueue the section tree frontend script.

Safe to call multiple times — wp_enqueue_script() is idempotent.

Since: 3.1.0
Line: 43

static public function enqueue_scripts(  ): void;

Returns: void

get_tree() static

Build the knowledge base section tree HTML.

Since: 3.1.0
Line: 78

static public function get_tree( array $args = ... ): string;
TypeNameDescription
array$args{

Returns: string — Tree HTML, or empty string when there is nothing to show.

context_product_id() static

Determine the product term ID for the current request.

Resolves to the queried product, the parent product of the queried section, or the product assigned to the current article.

Since: 3.1.0
Line: 214

static public function context_product_id(  ): int;

Returns: int — Product term ID, or 0 when none applies (full tree).

highlight_current() static

Mark the navigation entry matching the currently queried term as active.

Category/section nodes render with a wzkb_cat_{id} class, while product nodes render as wzkb-product-item with a wzkb-product-link anchor to the term, so each is matched differently.

Since: 3.1.0
Line: 562

static public function highlight_current( string $html, string $active_class = ... ): string;
TypeNameDescription
string$htmlTree HTML.
string$active_classCSS class added to the active item. Default ‘wzkb-section-tree__item—active’.

Returns: string — HTML with the active class applied.