Thord Daniel Hedengren - Smashing WordPress_ Beyond the Blog-Wiley (2014)

(avery) #1

CHAPTER 6 • Advanced Theme Usage 159


more, say a separate way of tagging posts, called To p i c s; you can add that, which gives you two
tagging taxonomies that can each take its own set of tags, separate from each other. And
finally, you may want a third one called Frequently Asked Questions, which would leave you
with three tagging boxes: the default one and the two new ones (see Figure 6-7).


Figure 6-7: Multiple tag taxonomies.


Naturally, there is a template file for taxonomies, called taxonomy.php. Create it and treat it
like any other archive, which means that it needs the loop, of course, and it will be used for
post listings generated by a click on a taxonomy link. As you might expect, you can create a
taxonomy-X.php template file for a specific type of taxonomy, and you can even target a
specific taxonomy term by creating taxonomy-X-Y.php (where Y is the specific taxonomy
value) as you can with tag.php or categories.php.


PURPOSES FOR CUSTOM TAXONOMIES


There are tons of things you can use custom taxonomies for. The strength of them, whether
you use them for hierarchical (such as Categories) or nonhierarchical (such as Tags) purposes,
is that they add yet another layer to your content organization. Here are some ideas:


◾ Collect series of posts with a nonhierarchical taxonomy and style the archives for this
taxonomy differently to make it more link-friendly.
◾ Add another navigational layer with a custom taxonomy. Say you run a video game site
and want to mark your posts with the video game platforms such as Xbox 360, iOS, and
Wii, but not mix this with the regular categories or tags. With a custom taxonomy called
Platform (or something else), you can.
Free download pdf