CHAPTER 6 • Advanced Theme Usage 139
◾ single-paged-X (where X is the page number, referring to posts with multiple pages)
◾ page-paged-X (where X is the page number, referring to posts with multiple pages)
◾ category-paged-X (where X is the page number, referring to listings)
◾ tag-paged-X (where X is the page number, referring to listings)
◾ date-paged-X (where X is the page number, referring to listings)
◾ author-paged-X (where X is the page number, referring to listings)
◾ search-paged-X (where X is the page number, referring to listings)
◾ tax-X (where X is the taxonomy name)
◾ term-X (where X is the term name)
◾ admin-bar
◾ custom-background
Using the classes outputted by body_class() is a great way to add more precise visual
control to the various sections of a site. A lot of template files in older themes have become
redundant because of minor visual tuning now being easily managed by the classes outputted
by body_class(). That’s a lot better than resorting to template file–specific classes.
STICKY POSTS
When sticky post functionality was introduced way back in WordPress 2.7, you needed to
add the sticky_class() template tag to your post containers. That added the class
'sticky', which could then be styled accordingly. You don’t need that anymore, thanks to
post_class(). In addition to the various tasks already mentioned, post_class() also
applies the 'sticky' class to posts that are marked as sticky from within the WordPress
admin.
Making the sticky posts stand out a bit is easy enough; just add something to .sticky in
your style sheet:
.sticky {
padding: 20px 20px 8px 20px;
background: #f8f8f8;
}
Nothing fancy there, as you can see (see Chapter 3, “The Loop,” for more on sticky posts). The
only thing to keep in mind when it comes to sticky posts is that you don’t know how many of
them will be used. If there are two sticky posts, the most recent one will end up on top, and
then the next newest one below. This means that several sticky posts need to look good when
placed together.
What are sticky posts good for? The most obvious use would be in a traditional bloggish site,
nailing the larger, important posts at the top using the sticky feature and unstickying them
whenever there’s something new to lift to the top. Something of a limited headline area,
so to speak.