Site icon WP Smith

Custom Post Types and Custom Taxonomies

Understanding WordPress Custom Post Types
To me, custom post types cannot be divorced from custom taxonomies. Two of the criteria that I consider before creating a custom post type is:

  1. Can my goal/objective be accomplished through the use of custom taxonomies?
  2. Do I need to use custom taxonomies?

This being said, WordPress's out of the box compatibility with custom taxonomies is still developing. However, one individual, Michael Fields, is pioneering WordPress's custom taxonomies functionality and capabilities. So I wanted to highlight some of the things he has already created.

Michael has excellent posts on Taxonomy in WordPress. To highlight one in particular, New and Exciting Ways to Organize Your WordPress Powered Website, which is all about how to achieve better organization in WordPress (for a text-only page, see Understanding Taxonomy in WordPress). In this post, he includes this video:

However, Michael has more on Taxonomy in WordPress including some extremely helpful plugins and widgets. Consider these:

Taxonomy Images Plugin

May 31, 2011 – This plugin allows you to associate images from your media library to categories, tags and custom taxonomies. … Download the plugin

Taxonomy List Shortcode Plugin

The Taxonomy List Shortcode plugin adds a shortcode to your WordPress installation which enables you to display multiple unordered lists containing every term of a given taxonomy. After speaking with Michael, Michael informed me that a massive overhaul is coming soon introducing full
theme integration plus special option(s) that integrate with Taxonomy Images. It should be very exciting.  … View this page, Download the plugin

Dealing with Long Taxonomy Descriptions in the WordPress Administration Panels

Probably Michael's most under-rated plugin. This plugin allows you to take full advantage of the taxonomy system the the latest version of WordPress. Unfortunately, the taxonomy administration panels tend to get quickly bloated where terms have descriptions that are longer than a few words. It trims the term description down to a short length when viewing multiple terms in the administration panels. If you have really long taxonomy descriptions then you might only be able to view one or two terms per screen. This plugin fixes that. Here is a quick and easy method to help put an end to long descriptions messing with your work flow. … View the code, Download the plugin

Taxonomy Widget Plugin

The Taxonomy Widget Plugin enables users of all skill levels to create widgets in their sidebar that display all terms of any given post taxonomy including tags and categories. Users can choose between 3 different templates including two types of lists, a term cloud or a dropdown menu. … View this page, Download the plugin

Taxonomy Terms List Plugin

This plugin will create a list for each taxonomy whose terms have been associated to a given post. These list will appear after the post content. This plugin will not effect builtin taxonomies such as categories, tags and link categories. … View this page, Download the plugin

One particular post that deserves some attention (and got Michael's attention) is Otto's post on Custom Taxonomies.

Advanced Taxonomy Queries in WordPress 3.1

Otto does a great job of explaining some of the additions to the taxonomy system in WordPress 3.1. I’ve been using this article as a reference for the past few days. ... View this Bookmark

Other posts by Michael include:

Set Default Terms for your Custom Taxonomies

Sep 14, 2010 – If you’ve ever created a post in WordPress, you’ll know that you have to put it in a category. There’s no way around this, if you try to fight it, you will lose! On the other hand, there is really no way to define a default for custom taxonomies. I created the following code to … View this post

Append a posts taxonomy terms to post class.

Jul 11, 2010 – The following code snippet will enable your theme to append the slug of every term of a given taxonomy that has been associated to the current post. You will most likely want to change the value of the $taxonomy variable to match a taxonomy registered for the post type you are targeting. View this post

Dynamically Create Actions for Every Defined Taxonomy’s Column Header

Jun 4, 2010 – Taxonomy support in WordPress 3.0 has improved in many places. During the time I spent updating a few of my plugins, I noticed that dynamic filters had been defined for the columns that appear on edit-tags.php – the file that lists the terms for each taxonomy in the administration panels. The following snippet demonstrates how … View this post

Remove Taxonomy Box from WordPress Administration Panels

While Michael only posted this for his own reference, it's good stuff nonetheless. I’m posting this here pretty much for my own reference. The idea is to create an array of taxonomy slugs that you want to hide from the Edit screens in The WordPress Administration Panels. You can then loop over the global $wp_taxonomies variable and if the taxonomy is present in the $hide array, the WordPress … View this post

Besides these excellent posts, Michael has a plethora of taxonomy plugins that are extremely useful. There was one particular instance that I needed something like wp_dropdown_categories() regarding custom taxonomies and Michael submitted a trac ticket in WordPress and via PasteBin. So Michael created a forked version of wp_dropdown_categories() calling it mfields_dropdown_taxonomy_terms(). Michael has since moved and revised the code in the Taxonomy Widget. The much simplified version which uses only a custom walker in the code of the taxonomy widget plugin (code starts on line 365 ... The custom walker is used on line 300 - args start on line 288).