Hey folks, I think I know the basic "definitions" of taxonomies, categories, and tags when used in Wordpress. I've been building websites since 1996 and I've been using wordpress for years. I'm not a newbie, but I sort of need you to talk to me like one on this one..sort of.
What I'm trying to grasp is how they would work "in practice" on a blog.
Say I'm making a blog that reviews different pizza joints.
Can you help me understand how I'd best use categories, taxonomies and tags when setting up this blog? Do custom post types also come into play?
My guess is that categories might cover the types of pizza restaurants:
"casual dining" like Pizza Hut
"pizza joint" like that locally owned place that you've been going to for years
"italian restaurants" italian restaurants that happen to have a good pizza on the menu
Then taxonomies might cover what? Location? Or would location be a category?
Tags would be what? Maybe quick keywords that describe the pizza: "cheesy" "great sauce"?
Ideally I'd like to setup the site so the visitor could sort by location, sort by rating (would a star rating be a taxonomy?), sort by price, etc.
Would custom post types come into play by making each blog post a "review post type".
<strong>**What I'm looking for here is someone to explain and help me understand how to put all these pieces together so I can use the tools the proper way when I launch my blog**</strong>
<em>In the [[LINK href="http://www.imdb.com/title/tt0107818/quotes?qt0179769"]]words of Denzel Washington[[/LINK]]: "Now explain it to me like I'm a four year old" :)</em>
PS. I'll be spreading the prize money around as necessary if there are multiple answers I find helpful in breaking this down for me.
Michael Fields answers:
First, I would figure out what kind of content you will be posting the most of. Reviews? If this is the case, then I would would create a category called review. All reviews would be posts with a "post" post_type. This will leave you open to create other categories such as "news", "announcents", "Contests"... basically anything you feel is a good idea for your site.
Tags - I personally do not use these at all... and would advise against their use on a site such as you are building. I think that they work well in a "blog" setting, but you are creating a review site and I beilive it would be in your best interest to brainstorm your own custom methods of organization.
"Types" - ( casual dining, pizza joint, italian restaurants ) I would create a custom taxonomy for this. You should not use a 'slug' of 'type' when you register it though. This will cause a lot of issues as there seems to be a ghost in the machine. I would use 'restaurant_type'. You can always change the names of the label to "Type" if you desire.
"Location" should definately be a taxonomy. It is one of the best examples of a heirarchical taxonomy that I have encountered. Keeping these separate from your categories is a must IMHO.
A star rating system using a custom taxonomy is also a great idea and I actually have one of these laying around that I can post to my site if you would like to see how I did this. Using a taxonomy will allow you to easily link to an archive of all pizza shops with 5 stars.
I would not create a review post_type at all... I would use posts.
In conclusion, I would always use posts for the main content of the blog. I would then use categories to create "sections" much like chapters in a book or section of a magazine. I never use nested categories. If you find that you need to nest categories, usually a new custom taxonomy is in order.
Here's an article I wrote about Taxonomy [[LINK href="http://wordpress.mfields.org/taxonomy/"]]http://wordpress.mfields.org/taxonomy/[[/LINK]] There is a godd convesation in the comments starting with Haluk.
Rodney Blackwell comments:
Hi Mike, thanks for the great breakdown! After reading it (and re-reading it), I think I have a MUCH better grasp on how they all should work.
I might take you up on the offer for the 5 star post type example. My rating system will be a bit more complex than just 5 stars, but hopefully it'll help me grasp how that part should work.
Can I ask why you wouldn't setup a review post type in favor of just using all "posts"?
Michael Fields comments:
No Problem, this is one of those topics that I have spend A LOT of time thinking about and coding plugins for. To answer your question about the custom post_type. I would only use a custom post type for content that I did not want in the main blog feed. I'm guessing that "reviews" would be the most important part of your site so IMO it should be up front. While there are work arounds that will allow you to add a custom post_type to the main feed, I do not like to use them. If I want it in the feed, I put it in a category, if I want it separate, I create a custom post type. On my site, I have a "bookmarks" custom post_type - because I do not want WordPress push every link I post to my feed.
IMHO posts should always be used for the "most posted" type of content. On my site, I mostly post code snippets. I've been tempted to create a custom post type for it but have always talked myself out of it because it would create a lot more work + a lot more code + possible things that I would have to fix in the future. Keeping it simple is always the way to go.
Joachim Kudish answers:
So since WordPress 3.0, there have been custom post types & custom taxonomies.
Custom post types are way to have new types of content. By default WordPress has two types of content posts and pages (although technically menus, attachments and revisions are also custom post types, but regardless). So with the help of a few functions you can register a new content type such as "porfolio" or "services" etc.. In your example, your pizza reviews should be a custom post type.
Custom taxonomies are ways for you to classify and organize your content. By default WordPress has two taxonomies, and you mentioned them, tags and categories. New custom taxonomies could be "location", "price", etc.. In the case of your example, you could have the number of stars for the review be a custom taxonomy, or the price bracket, etc...
Really think of custom taxonomies as a way of organizing your content.
Technically speaking there are two different "types" of custom taxonomies, based on either categories or tags. If based on Categories, you will get a series of checkboxes just like with the regular categories and if you base them on tags, you will get a input field where you can enter comma-separated values.
This is how I would personally set-up a pizza-reviewing website:
- Pizza Reviews as a custom post type
- Location as a custom taxonomy based on tags if the locations won't be frequently re-used, or based on categories if they will
- 5-star scale as a custom taxonomy based on categories
- Price as a custom taxonomy based on categories
You could leave tags as they are for your pizza-review for random tags as you mentioned
<blockquote>Maybe quick keywords that describe the pizza "cheesy" "great sauce"?
Then on this site you could still have a normal blog where you post other food-related articles. I would leave the default Categories for use only with the default posts. Allowing you to have a clear differentiation between posts and pizza reviews for example.
I hope this explains the differences between all of these things. It can definitely be confusing at first. It was for me until I really looked into it a few months ago.
Here are the related WordPress codex articles associated with these APIs:
If you want to use these in your site, you will need to register them either via a plugin, which in most cases will provide a user-interface for you, or via the native functions provided for this.
Here a few plugin recommendations:
Here are the codex references for the native functions. These will go either in a custom plugin or in your theme's functions.php file:
Please feel to let me know if you have any further questions.
Happy New Year!
Rodney Blackwell comments:
Thank you for taking the time to reply!
Are you suggesting that "pizza review" would be one custom post type and say "blog post" (like featuring pizza news) would be another custom post type?