The Stiz Media, LLC

Making your website work for you

  • Styles for Genesis
    • FAQs
  • Cart
  • My Account
  • Home
  • Web Design
  • Portfolio
  • Resources
  • Blog
  • Contact

Powerful websites, with style.

Home » Blog » Different Templates For Parent And Child Category Archives

Different Templates For Parent And Child Category Archives

January 28, 2015 Andhi Leave a Comment

Wellness Mama Recipes

This tutorial shows you how to use a different template via get_template_part() for parent and child terms of a post. You could make this work for custom post types or custom taxonomies too, but in my case it was just regular posts and categories.

The site has a category called “Recipes”, and a bunch of child categories like “Beef”, “Poultry”, “Breakfast”, etc…

The recipe index needed one template, while all child terms needed to share another template.

Thankfully, after some googling I came across a really cool function called cat_is_ancestor_of().

Conditionally pull in a template

Inside my category.php file I pulled a different template based on the term. See the code below.

Then, in my child theme I included 2 files in the /includes/ directory.

  • recipe-parent.php
  • recipe-child.php

From there you can do whatever you’d like. The contents of my parent file is some static HTML just showing links to each child category. The child categories show recipes in 3 columns with just the title and featured image.

I hope this helps and saves you the time I spent figuring it out!

Related Posts

  • Tabbed Content Page Template
    Tabbed Content Page Template In Genesis
  • A really organized life
    Genesis Page Templates in a subdirectory
  • Remove The Comma Between Categories And Tags In Genesis

Tutorials Categories, Templates

‹ Tabbed Content via AJAX in Genesis
Custom Post Type Filter Admin By Custom Taxonomy ›

Try The Most Powerful Genesis Child Theme Ever Created

Mai Theme is the most customizable Genesis child theme (and plugin!) available. Check it out now!

Learn More @ MaiTheme.com

Our posts, directly to your inbox

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Our posts, directly to your inbox


Howdy, I'm Mike Hemberger. I like to build nice websites and web apps with WordPress and Genesis Framework.

I'm passionate about everything I do, and it resonates in all of my work.

Feel free to email, and you'll be speaking directly with me.

Recent Posts

Restful P2P Example

Create Posts 2 Posts ‘connections’ with the WordPress Rest API

EA Share Count SMS button

Add SMS share button to EA Share Count plugin

ACF Extras

ACF Extras officially launched! A community of code snippets and field groups

Remove Items from TinyMCE editor

Remove Buttons/Items From The WordPress TinyMCE Editor

  • My Account
  • Affiliate Area
  • Log In|Log Out
  • GitHub
  • Instagram
  • Twitter
  • YouTube

Copyright © 2025 · The Stiz Media, LLC · All Rights Reserved