getButterfly Logo getButterfly code wrangling since 2005

In order to use WordPress 2.7 at its best, a couple of theme modifications are required. They include threaded comments, pagination, and sticky post features (as of WordPress 2.7 Beta 3). It took me about an hour to discover everything and unlock the full potential of version 2.7.

First of all, let’s start with the comments file. If you switch to WordPress 2.7 you won’t need to make your comments.php file backwards compatible. So, you’ll have to change it completely. Here is a stripped down, English version of comments.php, 2.7 compatible (again, as of WordPress 2.7 Beta 3).

Next changes, useful for styling pagination and sticky features, add these lines to your stylesheet file:

/* added for compatibility */
.aligncenter, div.aligncenter {
display: block;
margin-left: auto;
margin-right: auto;
.alignleft {
float: left;
.alignright {
float: right;
.wp-caption {
border: 1px solid #ddd;
text-align: center;
background-color: #f3f3f3;
padding-top: 4px;
margin: 10px;
/* optional rounded corners for browsers that support it */
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
.wp-caption img {
margin: 0;
padding: 0;
border: 0 none;
.wp-caption p.wp-caption-text {
font-size: 11px;
line-height: 17px;
padding: 0 4px 5px;
margin: 0;
.sticky {
font-size: 9pt;
border: 1px solid #bbb;
border-width: 1px 0;
background-color: #eee;
padding: 15px;

The border radius declarations won’t validate your CSS stylesheet.

In order to activate your sticky post feature you should edit your main index template (index.php) and find:

<div class="post">

and replace it with:

<div <?php post_class(); ?>>

This is the same as above, however it makes it dynamic and allows the theme to change post_class() when the post is sticky.

That’s everything that needs to be done to upgrade your theme. Note that your theme is now 2.7 compatible only, and it will fail in older versions.

More tweaks and tricks for your WordPress theme

If your theme features a narrow post area, just like mine, you should use no more than 3 levels deep for threaded comments. Do you know more tweaks? Let me know about them.

Subscribe to getButterfly Blog

Once a week or so we send an email with our best content. We never bug you, we just send you our latest piece of content.

If you found any value in this post, agree, disagree, or have anything to add - please do. I use comments as my #1 signal for what to write about. Read our comment policy before commenting! Comments such as "Thank you!", "Awesome!", "You're the man!" are either marked as spam or stripped from URL.

3 thoughts on “WordPress 2.7 Theme Compatibility

  1. Thanks. I’ve updated all my blogs already – I see some problems with some, but your fix has sorted me out.


Leave a reply

Love programming?

Learn about the most amazing things. Get smarter everyday!