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');
Related Posts:
- Categories overview that links to page displaying posts
- is_archive() content being shown instead of is_category()
- Which php file lists all the post of a category
- What Must to Display the “mysite.com/category” URL?
- Category link redirect to custom template page instead of index.php?
- Custom Archive Template for Multiple Categories
- Use different file includes for single.php
- Most efficient way to have 1 template for parent, 1 template for child categories?
- Template files not working for archives and categories
- How can I add the featured image functionality to a custom taxonomy?
- Taxonomy Templates… by hierarchical level?
- Preventing index.php?category_name=something from redirecting
- Make all subcategories use the template of its category parent?
- How to make custom taxonomy check boxes like ‘Categories’
- cat_is_ancestor_of() for custom taxonomies
- Are Categories, Tags and Custom Taxonomies any different in regards to SEO?
- How to create non-unique sub-category slugs?
- How to convert regular categories to custom taxonomy?
- Custom Post Type with Nested Taxonomy and Template Files
- Which template name to use for taxonomies but not their terms?
- How do I set a specific template for sub-categories?
- Removed slug from CPT, now How/where do I hook the filter to the taxonomy term archive pages link?
- Getting WordPress custom taxonomy/category?
- Display empty taxonomy terms with get_terms()
- Categories Template Assistance
- Order Taxonomy Term by date created
- How to override Category rendering mechanism
- How to control template resolution if both Author and Category filter in place?
- How to get the number of child categories a specific parent category has?
- Get multidimensional array that reflects category hierarchy
- Code to pull in a PHP file named after the category ID
- If statement within PHP echo
- Taxonomies for WordPress Media Library [duplicate]
- Are Category or Tag Archive Pages Possible?
- Possible to make a subdirectory that loops through a single category?
- Set a them for all subset of category
- How to display only posts assigned to a particular, isolated, subcategory
- Can you pre-check wordpress categories?
- Highlight wp_nav_menu when category is selected
- Different templates for different category tags
- How to show single category archive
- The default code for “posts_nav_link” on category.php isn’t working
- Only one post is showing on category page, why?
- How to organize custom categories for filtering and selecting
- Custom sub taxonomy order by
- How can I edit the ‘Most Used’ tab in the categories meta-box to show another custom taxonomy?
- Get all media categories
- Does “show_option_all” in wp_list_categories do anything?
- Get posts from specific taxonomy term
- How to insert category list into post creation page, and retrieve chosen categories?
- Why custom taxomony not showing when create a post?
- Avoid taxonomy-%term%.php if more than one taxonomy
- Question on using custom structures for categories
- custom page for custom Taxonomy
- Filter By Category Dropdown List With Custom Taxonomies
- query_posts by category_name and custom taxonomy
- Using if statement in index.php instead of creating separate template files
- Is it possible to create an alias/custom taxonomy for a category name?
- Template for product-category page [closed]
- Showing HTML if Post is In Certain Taxonomy Term
- I need to exclude from a query a category and a few custom taxonomies
- Displaying year once in category.php [duplicate]
- how to access the $query variable inside taxonomy-xxx.php template file?
- How to load several hierarchical categories from functions.php
- How to differentiate the homepage structure from the category page structure in WordPress template?
- Posts not listing out sub category in hierarchy
- Post to inherit custom category background image from parent
- How can I include custom category and tag base in template files?
- Custom Fields Value As Taxonomy
- How to get posts using category slug in ClassiPress?
- Include home page template in specific category template
- Link posts together (relative, not grouped)
- Showing different posts on category pages
- How to fix select filter on category
- Migrate the posts of a category to another blog as a custom taxonomy
- Taxonomy custom check box meta field not getting saved
- Grab all the posts for particular category
- How can i echo next and previous custom category from a Taxonomy
- How to load terms of a custom taxonomy of a product in woocommerce cart page
- Using heirarchial tags or Custom taxonomies
- Category custom template is not showing correct posts
- Single taxonomy for different custom post types
- Different template for subcategories
- Dynamically creating content on custom URL without getting 404
- How to exclude category and post_tag taxonomy while displaying custom taxonomy?
- New Category – custom taxonomy
- Choosing different templates for categories
- Show posts from all categories
- List Terms by category
- Category Templates for Post Types not Working
- One category not displaying template updates
- Create Cross Promoting Categories in WordPress Using ‘pre_get_posts’
- WordPress doesn’t respect the template hierarchy?
- How do I get a single page navigation depending on the previous page?
- Add 1 category more to If_in_category statement
- Category Template – to be editable from the backend?
- have_posts is empty on category.php
- How to Organize my Photo Albums?
- How to create a template for categories
- Taxonomy page wpml dropdown not working