Term_Featured_Image
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;
| Type | Name | Description |
|---|---|---|
string | $hook_suffix | Current 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;
| Type | Name | Description |
|---|---|---|
\WP_Term | $term | Term 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;
| Type | Name | Description |
|---|---|---|
int | $term_id | Term 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;
| Type | Name | Description |
|---|---|---|
string | $html | Existing image HTML (empty by default). |
\WP_Term | $product_term | Product 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;
| Type | Name | Description |
|---|---|---|
string | $html | Existing image HTML (empty by default). |
\WP_Term | $term | Term 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;
| Type | Name | Description |
|---|---|---|
string | $block_content | Rendered block HTML. |
array | $block | Block data array. |
Returns: string — Block HTML with image appended, or unchanged.