Chapter 11: Design Trickery
This chapter is all about making your WordPress theme more interesting and giving it that extra functionality that makes it pop. Some of the techniques covered here are directly tied to WordPress and the kind of data you can get out of it, whereas others are adaptations of other techniques and solutions that can come in handy for your projects. This chapter shows you a variety of cool tricks: how to use tag-based design, make the menu do your bidding, include both style sheets and JavaScript libraries the proper way, make your 404s help the lost visitor, and work with ads within the loop.
In other words, get ready for some WordPress design trickery.
Adding More Control over Your Posts
WordPress offers various methods for adding more control over your posts. This section covers three such methods: tag-based design, custom fields, and adding your own taxonomies. I won’t go over post formats again here, as it is covered in Chapter 6, “Advanced Theme Usage.” Otherwise, that is a great way to get more control of your posts.
Tag-based Design
The most common setup for a WordPress site revolves around categories and Pages. The former gives individual control of post listings and can be queried by conditional tags such as in_category()
, which means that you can make them all behave differently. This in turn means that a category archive can easily become a section on a site in a most natural way, and posts belonging to that category can get adequate styling ...
Get Smashing WordPress: Beyond the Blog, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.