post

Category Template Hierarchy

Adds several new templates to the template hierarchy:

  • child-of-category-{slug}.php
  • category-{slug}.php
  • child-of-category-{id}.php
  • category-{term_id}.php
  • parent-category.php
  • child-category.php
  • category.php
  • archive.php
  • index.php

This greatly extends the native hierarchy of theme templates with regard to
categories. Theme developers can now easily create separate templates for
categories with children, with parents, and children of specific parents.

Additionally makes available four (4) new conditional template tags:

  • is_child_category();
  • is_parent_category();
  • is_child_of_category();
  • is_parent_of_category();

These functions are available for use in any theme or plugin as along as this
plugin is active. For detailed documentation of these functions see the
‘Developer Notes: Conditional Tags’ section of this readme file.

Note: This plugin does not actually create parent-category.php, child-category.php
or any of their related templates – rather it modifies the native template hierarchy
to allow theme developers to create specific templates for parent and child categories.

About Travis Smith

As a WordPress Enthusiast, Travis writes about his journey in WordPress trying to help other WordPress travelers and enthusiasts with tutorials, explanations, & demonstrations of the things he learns.