A taxonomy is a way to organize content. You’ve probably used two taxonomies before: categories and tags. But WordPress allows you to create as many as you’d like to organize your content in whatever ways make sense to you.
I mostly use taxonomies when I’m also using Custom Post Types. Categories and tags make sense for posts, but when you make a new content type you might also need to create new ways of organizing that content.
I recently rebuilt my portfolio and used custom taxonomies heavily in the development. I created taxonomies for important information attached to all projects. This made it easier to add the information and provided tools for sorting by that information.
I created three new taxonomies: Framework, Designer, and Price Range. You can see them in action on the individual project pages (displaying the information) and in the sidebar (sorting the information). Here’s a screenshot of the screen I get when I add a new project:
Creating Custom Taxonomies
First I’d recommend you visit the WordPress Codex and read up on the function register_taxonomy, as that will show you all the great things you can do with it. Here’s the code I’m using to register Price Range:
Displaying Custom Taxonomies
Once you have your taxonomy created and have some content in there, you’ll want to display it. You’ll use the function the_terms(). Here’s the code I’m using to display the framework type on individual project pages:
The first argument is for the post ID, the second for the taxonomy name, the third for what’s displayed before the listing, the fourth shows the separator to use if there’s multiple terms (I’m separating with commas), and the last argument is for what’s displayed after the listing.
Sorting by Taxonomy
In the sidebar for my portfolio page you’ll notice I’ve provided links to the taxonomy archive pages. For example, you can view posts that were only built with Thesis (taxonomy = framework). I’m simply using wp_list_categories(); – by default the taxonomy is set to category, which is why it usually lists the categories. Here’s the code that’s making the “By Framework” section:
Miscellaneous Tips
- If you’re using Thesis, use the Custom Loop API to display them the way you want. I created two custom loops: one for the page “Portfolio” that pulls all the posts in the projects post type, and one for how taxonomy pages are displayed (so they matched the portfolio page).
- To display things on the individual posts in the custom post type, use the conditional
if(get_post_type() == 'projects'), where ‘projects’ is the name of your post type. I used this to stick the project information below the headline. - Use the conditional
is_tax()to display things on the taxonomy archive pages. - To get a list of all items in a taxonomy (ex: all project types in the taxonomy “Project Types”) use get_categories().



Bill,
Very informative post. And I have to say, the display, organization and detail of your portfolio is fabulous! It’s the best I’ve seen for any web designer. Bravo!
Bill,
I’ve created a custom post type, with two taxonomies related to it (Post Type “License” and taxonomies “State” and “Job” – essentially, jobs that require licenses in specific states). I’ve installed the Custom Permalinks Plugin to alter the permalink structure of the taxonomy pages so that license pages show up as site.com/state/job/ instead of site.com/license/. I’m going to eventually link the taxonomy pages to pods data, but that isn’t a big deal just yet.
My problem is that I can create a state-specific taxonomy page using the thesis custom loop for archive() (or taxonomy(), both work similarly) but it doesn’t appear to work for the job taxonomy, only the state taxonomy. For instance, site.com/washington and site.com/washington/carpenter show the same state information page, rather than two different sets of information (and site.com/carpenter doesn’t work at all). I’d like to have site.com/state show custom info separate from the site.com/state/job or the site.com/job/
My question is, how do I discern between two taxonomies like this? I’d like to have a page for the state, a page for the job, and a page for /state/job/ all built on-the-fly with the custom loop and taxonomy archive. Ultimately, the site is about the licenses for a job in a state, but having the other pages will help create broader pages with information about the job or state in general.
Hoping you can help!
Thanks,
Joshua
This is actually a really complicated issue and beyond the scope of this tutorial. I’m planning to publish another post on this exact subject once my client’s site is live, but I’ll email you directly with some helpful info.
Thanks for all the valuable information Bill. If I could ask one question, how did you get the “Featured Image” to display above your custom taxonomies? I added two taxonomies and they are both sitting above the featured image. I looked for some type of menu_position in the plugin advance options, but don’t see anything.
Thank you!
This just depends how your theme file is constructed. I’m simply calling the_post_thumbnail() before I call the_terms()