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 lost visitors, 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 those are covered in Chapter 6, “Advanced Theme Usage.” Using post formats, though, 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 all categories 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 Smashing WordPress: Beyond the Blog, 4th 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.