Different templates for parent and children categories/taxonomies

I suggest creating 3 files

1) regiontemplate-country.php

2) regiontemplate-city.php

These 2 will contain the templates for country & city, then

3) taxonomy-region.php

In this file, add the code to load the appropriate template

<?php
$term = get_term_by('slug', get_query_var('term'), 'region');
if((int)$term->parent)
    get_template_part('regiontemplate', 'city');
else
    get_template_part('regiontemplate', 'country');

Leave a Comment