Custom template not parsed and answsers with the raw code
-
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 ?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Custom template not parsed and answsers with the raw code’ is closed to new replies.