[ad_1]
Hello,
Using a category_template filter to route the template picking from a custom condition :
<?php
add_filter('category_template', function ( $template ) {
$category = get_queried_object();
// custom condition
if( $category->parent == 1 ) {
$template = locate_template('templates/category-1.html');
}
return $template;
});When requesting the category 1 page directly, everything goes right so it’s not about the template format itself.
But, when requesting one of its child and entering the custom condition, it’s like the template is not seen as a template and the html answer shows the raw content of the file :
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
[…]
<!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->What am I missing ?
