Chapter 12. DESIGN TRICKERY
This chapter is all about making your WordPress theme more interesting, and giving it that extra functionality that makes it pop. Yes, I know, that's a buzzword, but there are some techniques that are just too useful not to get into. Some are directly tied to WordPress and the kind of data you can get out of it, while others are more of adaptations of other techniques and solutions that can come in handy for your projects.
In other words, get ready for some design trickery, spinning tags and creating great menus. We'll also dive into how to properly work with JavaScript, getting ads into the loop, and customizing the login form.
Tag-based Design
In almost every case, a WordPress site should be built 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 if you want them to. At the very least, this can be a specific set of colors for the category, or perhaps an icon or other kind of graphic, but if you take it further it could be a completely different style of content presentation.
Tags, on the other hand, are less fixed and generally work best if used to only describe individual posts. That means that they may seem redundant for more static (or other ...
Get Smashing WordPress: Beyond The Blog 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.