Hi guys. im trying to make a custom template for each category that i got.
Im having trouble to getting this work, i added a base-category.php but it didnt replace the main base.php
I use to have this on custom.php to see what are the roots template that the page displayed is using but now isn’t working anymore
add_action('wp_footer', 'roots_wrap_info');
function roots_wrap_info() {
$format = '<h6 style="color:#FFF;">The %s template being used is: %s</h6>';
$main = Roots_Wrapping::$main_template;
global $template;
printf($format, 'Main', $main);
printf($format, 'Base', $template);
}
The base-category.php template will only take precedence over base.php when you are using category.php to display your categories, or when you add a filter (see the custom post type filter towards the end of this article).
The easiest way to do this is to duplicate base.php and index.php and rename them base-category.php and category.php respectively.
The filters in roots will allow me to get the same template for a child category?
I got a “videos” category and then inside videos i got “media”, if i create category-videos.php it only works with “videos” category but not the child category “media”, for these i need to make a filter right? o there is another better way?
I would check conditional statements. The only thing that changes in diferents category is the way post are displayed, Videos and child of videos will be displayed as square with info and other will be as a list with thumb.