webberzone.dev Recent

Term_Featured_Image class Pro only

Adds a featured image field to KB taxonomy terms and renders it in the product grid.

Namespace: WebberZone\Knowledge_Base\Pro
Since: 3.1.0
Source: includes/class-term-featured-image.php line 21

Methods

__construct()

Constructor.

Since: 3.1.0
Line: 40

public function __construct(  );

enqueue_scripts()

Enqueue media uploader scripts on KB taxonomy admin pages.

Since: 3.1.0
Line: 61

public function enqueue_scripts( string $hook_suffix ): void;
TypeNameDescription
string$hook_suffixCurrent admin page hook.

Returns: void

render_add_field()

Render the image field on the Add Term form.

Since: 3.1.0
Line: 124

public function render_add_field(  ): void;

Returns: void

render_edit_field()

Render the image field on the Edit Term form.

Since: 3.1.0
Line: 140

public function render_edit_field( WP_Term $term ): void;
TypeNameDescription
\WP_Term$termTerm being edited.

Returns: void

save_meta()

Save the featured image term meta.

Note: No nonce check needed — WordPress core verifies the nonce in wp-admin/edit-tags.php before firing created_{taxonomy}/edited_{taxonomy}.

Since: 3.1.0
Line: 160

public function save_meta( int $term_id ): void;
TypeNameDescription
int$term_idTerm ID.

Returns: void

render_product_card_image()

Inject the featured image into a product card in the product archive grid.

Hooked to wzkb_product_card_image.

Since: 3.1.0
Line: 187

public function render_product_card_image( string $html, WP_Term $product_term ): string;
TypeNameDescription
string$htmlExisting image HTML (empty by default).
\WP_Term$product_termProduct term object.

Returns: string — Image HTML or empty string.

render_term_archive_header_image()

Inject the featured image into a taxonomy archive page header.

Hooked to wzkb_term_archive_header_image.

Since: 3.1.0
Line: 208

public function render_term_archive_header_image( string $html, WP_Term $term ): string;
TypeNameDescription
string$htmlExisting image HTML (empty by default).
\WP_Term$termTerm being displayed.

Returns: string — Wrapped image HTML or empty string.

append_image_after_term_description_block()

Append the term featured image after the term-description block in FSE templates.

Hooked to render_block_core/term-description.

Since: 3.1.0
Line: 237

public function append_image_after_term_description_block( string $block_content, array $block ): string;
TypeNameDescription
string$block_contentRendered block HTML.
array$blockBlock data array.

Returns: string — Block HTML with image appended, or unchanged.