O'Reilly logo

Smashing WordPress: Beyond The Blog by Thord Daniel Hedengren

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required