Plugin Update: Category Template Hierarchy 1.3

Download Category Template Hierarchy Version 1.3 from the WordPress Plugin Repository

I’ve release an update to the Category Template Hierarchy plugin, a particular bug report prompted the update but there are a couple of other changes as well.

I use this plugin for three sites I’ve worked on for Sears / Kmart, so over time I make  minor changes to resolve issues I notice or improve how it works, but I don’t always have time to release those changes publicly.

A recent bug report forced to release a fix, and gave me an opportunity to update the plugin. Some of these changes effect how the plugin behaves, so it could impact your site if you depend on this plugin to keep your theme working. Here are the changes

  1. Improved performance be removing completely unnecessary logic to determine current category while building the list of potential templates to use. (No behavioral effect)
  2. Changed the filter used by the plugin. Before it used the very broad and general ‘template_redirect’ filter, but that caused obvious problem with other parts of the hierarchy, so not it uses the ‘category_template’.
  3. In addition to changing which filter is being used, the plugin used to `include()` the `get_query_template()` function, but now returns `locate_template`. This should resolve a bug where global variables such as $post were not available from within the loop.
  4. Logic in the `is_child_of_category()` and `is_parent_of_category()` has changed to check `!isset($child_category->parent) || !isset($parent_category)` instead of `empty($child_category) || empty($parent_category)`. This could effect your code if you use these conditional tags for anything in your theme.

The only item that does not effect any behavior is #1. Items #2 and #3 change the way the template hierarchy effect other parts of the native Template Hierarchy, so if you’ve seen strange behavior with non-category templates then you’ll definitely benefit from these changes. Item #4 is important as well, since it simply makes the conditional results much more accurate.

I don’t know how often people use the conditional functions, or how many of the couple thousand people who’ve downloaded this plugin actually use it at all – but I really appreciate the bug reports and any feedback. As I’ve said, I use these plugins myself on productions sites – so the public QA is always appreciated.

Download Category Template Hierarchy Version 1.3 from the WordPress Plugin Repository

Enjoy!

Advertisements


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s