Threaded Comments in WordPress 2.7

This was pretty quick and easy, really, you don’t even have to do much code, it’s more about styling the nested comments. First of all you have to switch them on in Settings – Discussion, then some slight theme modifications in header.php and the comments.php section. I don’t want to write about them here because it’s already written in the WordPress codex over here: Enhanced Comment Display.

Make sure you don’t skip the javascript modifications section, though I managed to get threded comments without it, but javascript makes it alive. It’s the code that is responsible for putting the reply form just below the comment you want to reply to on the fly, i.e. without having to reload and render a new page.

Now use Firebug to create and modify CSS on the comments page – just use your imagination and make it look good. The issues I had are:

  • The textarea box was ~700px wide and it overlayed my sidebar when I tried to reply to someone. Changed that to 100% – looks good now
  • The comments and replies are actually different elements. The comments are OL (ordered list) and the replies are UL (unordered list). The UL with the classname ‘children’ should have the margin-left, don’t mess that up.
  • Threded comments can be lost without borders. I don’t really like how they look in the default theme, but my variant is a little bit of padding-left and border-left for the UL/OL commentlist/children LI elements.
  • The ‘Reply’ anchor is not part of the comment and is not within the P tags, so I had to margin-left that separately.
  • The comment form in a reply needs a margin-left, but doesn’t when you’re starting the thread. You can use something similar to this (.comment indicates that it’s a reply and #respond is the actual form):
    .comment #respond { margin-left: 42px; }

I guess that’s it. Questions and suggestions are welcome in the comments.

Running Coltrane

The upgrade went great, spent about 10 minutes on everything. Here’s my version of a quick guide, assuming you have SSH access. Start off by disabling all your plugins through the wordpress administration panel and doing a complete backup (including database). Then load up your putty or whatever SSH client you are used to. My wordpress is running from /home/kovshenin/wordpress/ and here is what I did:

cd /home/kovshenin
gunzip latest.tar.gz
mkdir wp27
tar -xvf latest.tar -C ./wp27

This is to download the latest version of wordpress from the official wordpress resource, unzip it (gunzip) and extract (tar) to /home/kovshenin/wp27.

Next, just like the wordpress upgrade guide said, remove your wp-admin and wp-includes directories, and then copy the new files to the old location:

cp -R wp27/wordpress/* wordpress

You’re almost done. Launch the database update script by browsing to, and voila! Make sure you update all the plugins that you used and re-enable them. I’m just lovin’ my new dashboard!


Finally, WordPress 2.7

I’m so proud they finally did it. After the RC2 coming out I thought they’ll have problems up until January, but there they go! It’s nice to see that people are already upgrading their blogs, and as for Russia, we’ve got developers who’ve done the translation already, so I guess I’ll be running it in two or three weeks. Don’t wanna hurry though, and haven’t got much time neither.