With upcoming WordPress 2.7, just released in beta 3 as I’m writing this, styling your categories gets even easier. Previously, you more or less had to do a conditional tag thing and echo a specific class to get some custom styling, but no more.
Enter this little line of code:
[php][/php]
The only thing it does, when it’s inserted in your post’s div
tag, is write class="post"
. In other words, you replace your class="post"
with post_class()
.
Why? Well, this little thing adds some other nice classes to each post as well. We’ve already discussed the sticky post class, sticky
, in a previous article here on Devlounge. Besides that one, it adds the following classes:
category-X
where X is the post’s category, one for each category, so it could becategory-games
and [Read more…]