Block_Template_Manager
Class Block_Template_Manager
Manages block template registration using native WordPress 6.7+ API with fallback support for pre-6.7 versions.
Namespace: WebberZone\Knowledge_Base\Frontend
Source: includes/frontend/class-block-template-manager.php line 21
Methods
__construct()
Constructor for Block_Template_Manager.
Line: 47
public function __construct( );
add_search_template_to_hierarchy()
Add wzkb-search to the block template hierarchy for KB search pages.
Line: 71
public function add_search_template_to_hierarchy( array $templates ): array;
| Type | Name | Description |
|---|---|---|
string[] | $templates | Ordered list of template slugs to look for. |
Returns: array — Modified list of template slugs.
register_block_templates()
Register block templates using native WordPress 6.7+ API.
Line: 82
public function register_block_templates( );
inject_legacy_templates()
Inject templates for pre-6.7 WordPress versions.
Line: 98
public function inject_legacy_templates( $query_result, $query, $template_type ): array;
| Type | Name | Description |
|---|---|---|
array | $query_result | Array of found block templates. |
array | $query | Arguments to retrieve templates. |
string | $template_type | Template type (wp_template or wp_template_part). |
Returns: array — Updated array of found block templates.