Category Template Hierarchy
Adds parent-category.php, child-category.php, and child-category-{slug|id} templates to the hierarchy and conditional tags to match.
The facts
- Rating
- 5★ from 3
- Active installs
- 100+
- Price
- Free
- Last updated
- 24 Mar 2012
- Added
- Dec 2011
- Requires WP
- 3.0
- Tested up to
- WP 3.3.2
- Downloads
- 19,519
Our analysis
AI-assistedCategory Template Hierarchy is a WordPress plugin designed for theme developers. It extends the native template hierarchy for categories by allowing the creation of separate templates for parent and child categories. This enables more granular control over how category pages are displayed.
The plugin introduces several new templates and conditional tags that developers can use in their themes or plugins. It does not create templates automatically but modifies the hierarchy to facilitate the development of specific templates for different category structures.
Best for: This plugin is suitable for theme developers looking to enhance category template management.
What it does well
- ✓Extends native template hierarchy for categories
- ✓Allows creation of specific templates for parent and child categories
- ✓Introduces new conditional template tags for developers
Where it falls short
- •Does not create templates automatically; requires manual creation by developers
- •Last updated in March 2012, which may affect compatibility with newer WordPress versions
Verdict
Category Template Hierarchy provides useful functionality for developers needing to manage category templates more effectively, but its age may limit its compatibility with recent WordPress updates.
From the developer
Eddie Moya's own description of Category Template Hierarchy, lightly tidied.
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.
Developer Notes: Template Hierarchy
What follows are is the modified list of templates available for category pages.
These expand upon the native 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
The parent and child templates only become available if the current category is
a parent or a child respectively.
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.
Developer Notes: Conditional Tags
With this plugin comes two additional conditional tags
which behave much like any other in WordPress. In a similar fashion to how one
might use is_category() or cat_is_ancestory_of(),
developers may, with this plugin, use the following functions:
- is_parent_category()
- is_child_category()
- is_child_of_category()
- is_parent_of_category()