WordPress 2.8 introduced a “simple” way to add taxonomies to WordPress. It still required coding though. This plugin allows you to add taxonomies just by giving them a name in the backend. It then creates the taxonomy for you, provides a widget you can use to display a “taxonomy cloud” or a list of all the stuff in there, and it allows you to show the taxonomy contents at the end of posts and excerpts as well.
Get it now!
Creating a Taxonomy
Let’s create our new taxonomy first, by going to Posts -> Simple Taxonomies (it’s under posts because it currently only works for posts).
You’ll see something like this:
As you can see, you can enter almost the same thing for the “Name” & Slug as you can for the Label, and you should make it a plural term. In the future, I expect you’ll need to add the “single” of that term as well, but WordPress does not support that as of yet. If you’ve added these two, you can save the settings, and ignore the other options for now.
Add or Edit a post
Now, when you go to your new post or edit post screen, you’ll see a new box, just below the “Post Tags” box, with the name of your Taxonomy. It works exactly the same as your Post Tags box, so you can just enter values, or choose from most used values (still called tags in this screen). Once you’ve added one, it’ll look something like this:
Once you’ve added those new values to a bunch of posts, you might want to start showing them off to people. There’s several ways of doing that, the first of which is the use of widgets. The plugin comes with a Taxonomy Widget, that allows you to easily show off your newly made taxonomy. Just go to the widgets admin page (Appearance -> Widgets), and add the “Yoast Taxonomy Widget” to your sidebar. You can then configure it like this:
Adding your taxonomy to posts and excerpts
You can also show of your new taxonomy by adding the values to the end of posts or excerpt. To do this, you go back to the Simple Taxonomies admin page, and check either or both of the two boxes underneath the name and label. It will then show like this on your posts and/or excerpts.
Styling of output
To allow for maximum styling, the HTML looks like this (inserted some extra line breaks for readability):
<div id="yoast-taxonomy"> <span class="taxonomy-people"> People: <a href="http://example.com/people/joost/" rel="tag">Joost</a>, <a href="http://example.com/people/marieke/" rel="tag">Marieke</a>, <a href="http://example.com/people/tycho/" rel="tag">Tycho</a> </span> </div>
Taxonomy related template functions
Especially for template authors, or for people who don’t mind tweaking their own theme, this plugin comes with a bunch of template functions as well, most useful in taxonomy template files.
||Outputs the title for the current term|
||Returns the title for the current term|
||Outputs the description for the current term|
||Returns the description for the current term|