Of the many excellent new features coming in WordPress 2.7, some are applauding the arrival of sticky posts.

First – what are they? Sticky posts are posts that you can “stick” to your front page. For instance, if you have a post that you published a year ago and would like to republish it to the front page of your site for a time – you can edit that post and select “Stick this post to the front page” in the Edit Post page in your WordPress admin panel. Just doing that will stick it to your front page, ahead of all the other posts on your site.

You can use CSS to style those sticky posts, as well. All you need is this markup:

<div <?php post_class() ?> id="post-<?php the_ID(); ?>">

That will insert a class=”sticky” above your post and you can use CSS to style .sticky. Cool, eh?

More? Yes, there is more. That same tag will insert special classes for your categories and tags, as well. An example?? I’m glad you asked! Hypothetically, I have a sticky post that I’ve filed in the Misc category and tagged with News, WordPress and Markup. With me so far? With all of that, plus the post_class(); tag in my template – my source code for that particular post looks like this:

<div class="post sticky hentry category-misc tag-news tag-wordpress tag-markup" id="post-ID">

Now, I can use CSS to create special styles for the following classes:
– .post
– .hentry
– .sticky
– .category-misc
– .tag-news
– .tag-wordpress
– .tag-markup

As an example, the code in your index template (and/or single/archive templates) may look like this:

<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h3 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Article about: <?php the_title(); ?>"><?php the_title(); ?></a></h3>
<?php the_content('<span class="more-link">'.__('Read More &raquo;').'</span>'); ?>
</div>
<?php endwhile; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
<?php endif; ?>

I forsee lots of people having lots of fun with this! I am doing some custom work for some clients 2.7 (beta) right now, with the intention to launch them once 2.7-final is released. I’m having good fun working with the new post_class(); tag and the new features of sticky posts, threaded and paged comments. I’m excited for WordPress to release 2.7-final into the wild!