Build Your Own Business Website header image

Community News Case Study Part 1 – Custom Taxonomy vs Custom Post Types

Whoops, you've found some premium content!

Watch the opening clip of this video to preview it,
the full video is available to paid members.

This is the first in a series of live discussions on using WordPress and Thesis as a Content Management System (CMS). One member asked how to create a “Community News” site so that each community had its own “blog” page or “articles” page.

The goal here is to have a site that allows categorization by community while still preserving the role of “categories” and “tags” in the content management scheme.  In this video we discuss the organization of the site.

  • What is a custom taxonomy?
  • What are the roles of the custom taxonomy, categories and tags?
  • Permalink issues with the custom taxonomy
  • custom post types vs custom taxonomies

Video Transcript

People have probably stayed on here waiting to see these custom taxonomy conversations so I’m going to keep on going with this for a little while. This is off of a… again, off topic but I’m sorry, this is not based on a specific question here for the day but it is something that I’ve prepared for the purpose of talking about a question that was asked last week about how to create a site where you have different communities. So in this case, I’m going to use Edmonds in Seattle but you have a group of communities where you have news about each one of those communities and you want that news to be displayed on that community’s page. So on the Seattle page and on the Edmonds page because then that prevents you from using categories below that like you know, local events and fun stuff to do on the weekend. And so, what I proposed was using a custom taxonomy for adding another level of organization to the site.

However, taxonomy is a way of organizing a WordPress post and currently, WordPress supports 2 taxonomies that you’re familiar with. It supports categories and it supports tags. And both of those things are independent of each other. Categories are a hierarchical so for example, on my site, I’ve got lots of categories and so I have… in fact, I have a section called you knows, Video Tutorial Series. That’s one category. Inside that category is Ask the Architect which I have one post in it from way back when and Configuring Customized Plugins and then inside that category, there’s a contact form 7 and then inside that category is another category of Lessons. And then Customize Thesis Like a Pro is a category inside of Video Tutorial Series and inside of that is Customizing Backgrounds and Using Fixed Background Images and so on and so forth. So you’ve got this hierarchical method of organizing categories.

And then tags operate complete differently from that. Tags have no hierarchy. So you don’t have a 301 redirect a tag and then as a subtag of 301 redirect, I have advanced recent post. There’s no sub and sub-sub version of any tag. Each tag stands on its own entirely.

The net result of that is that the right way to organize posts is to have one category for every post. So, a post can only have one category assigned to it but then it can have unlimited number of tags assigned to it. And so that’s sort of the default or the general mechanism of organizing posts.

If we want to use categories and tags in that default way but also want to sort that information and display it by community, we’ve got to have another layer of organization and that’s what custom taxonomy is. A custom taxonomy is either hierarchical or not. So it either behaves like a category or it behaves like a tag. And it’s one more layer of organization that you can apply to posts. And so in this case, I recommended that Doug do is to create a custom taxonomy called Community. You would have one community would be Seattle, another community would be Edmonds and then you would assign that custom taxonomy to each blog post. So if there was a category of say, Sunday events and you has a list of Sunday events for Seattle and a list of Sunday events for Edmonds, you would create blogs but then they’d have the additional taxonomy of the community which would either be Seattle or Edmonds. And so then, you could display on a page the events for Edmonds, Sunday events for Edmonds and Sunday events for Seattle as being separate elements.

However, as I was preparing for this presentation this morning, I realized that you know, this whole custom taxonomy thing is still relatively new in WordPress’ history. And you know, if you were going to have a news site like that, you’d want URLs that said And unfortunately, custom taxonomy category takes precedence over custom taxonomy and so, the post itself would actually be named you know, and then the post name. And it wouldn’t have on its title the name of the community because of the way taxonomies are used in URLs. And the default taxonomy structure does not provide for you to put the taxonomy name in the URL itself unless you’re looking at a taxonomy archive. And as soon as you want to look at you know, all of the posts in the taxonomy community under you know, the term Seattle, that you can do. And then it would say you know, mycommunitynews/Seattle but that would automatically be indexed that way which then suggests that maybe, that’s not the best way to organize a site because I think, especially a community site, that taxonomy name would be important.

Now, I’m told from what I’ve read, that WordPress 3.1 changes the permalink structure so that you can add taxonomy to that instead but I haven’t seen any documentation for that and I have looked through the latest version of a code and I can’t see any place where that would be the case. So I’m guessing that taxonomy is not being added as a permalink, part of a regular permalink structure which means that maybe, there’s a different way to do this. And the different way to do this instead of using a custom taxonomy is to use a custom post type. Now custom post types do their names do take precedence description or in the URL of the permalink structure URL. And so if you have a custom post type named Seattle and a custom post type named Edmonds, then it would say you know, and then it would give you the category after that. And that’s seems to me the ideal way to do it.

Now if you’re doing a new site with 50 different communities, then it’s probably not ideal because you would end up with essentially a dialogue box like this for every single community and that’s probably not manageable. But if you’re looking at 3 or 4 or 5, it’s probably very manageable and that’s how I would recommend that you do it. So that’s by way of introduction to the topic of dealing with custom taxonomy.

0 Comments… add one

Save $200 on Membership Now!

Start learning today for as little as
$0.82 PER DAY!
Subscription Options
0 comments… add one

Leave a Comment