Brian’s Threaded Comments: Optimized

One of the plugins I love to run on my blog is Brian's Threaded Comments. It allows for communications to be nested, organized and very easy to read and respond to. I'm not sure why the logic hasn't been pulled into the core of WordPress, though.

As I viewed the source of my pages, though, the plugin added quite a mess. The plugin inserts both Javascript and styling tags to get it to work. The problem is that inline styling and javascript can increase load times because linked stylesheets and javascript files can be cached once by the browser.

Since search bots index the top ‘x' amount of a page, code like this pushes the real content down. I've not heard of it proved, but I believe this can impact your site's Search Engine Optimization. The right way to feed a Search Engine is to skip the toppings and provide more meat. I did just that and moved both the Javascript and the CSS to a linked file. I'm running the optimized plugin here.

I've written Brian on the optimized plugin, but the email bounced. I also threw him a tip from my blog to see if he'll stop by. If you're interested, you can download the optimized plugin here.


  1. 1

    Thank you very much for posting this file!
    I briefly (less than ten minutes) dipped my toe into Intense Debate because easily installed threaded comments appealed.. Much as I love tooling out my site, their system was too much to put up with for this luxury alone.

  2. 2

    I was looking at your files in the zip and it looks really good, however someone beat you to the punch back in April. Check out this post.

    Something else to improve upon would be having the images local verses having them called from an external location with some sort of encrypted code, at least that’s what it looks like around the lines where it calls the png images.


  3. 4

    Hi Doug,
    Thanks for this?I was about to endeavor to do the exact same thing, you saved me the time.

    I had to add a few functions from Brians Threaded Comments 1.5 that were breaking your iteration.
    Above btc_add_reply_id($id):

    function btc_has_avatars() {
    if( function_exists('get_avatar'))
    return true;
    else if(function_exists('MyAvatars'))
    return true;
    return false;

    function btc_avatar() {
    if( function_exists('get_avatar')) {
    echo get_avatar(get_comment_author_email(), '64');
    else if(function_exists('MyAvatars')) {

    I also added a little CSS from BTC 1.5 to the .css file:

    .btc_gravatar {
    float: right;
    margin: 3px 3px 4px 4px;
    .collapsed .btc_gravatar { display:none; } /* I added this, since the gravatars weren't collapsing nicely */

  4. 5

    This is great, Doug! One issue: It seems that the plugin now wants to be in the briansthreadedcomments subfolder of plugins, but a few of the images are rendered by accessing the PHP file in the plugins directory (when a user has subscribed to email alerts, for example). I worked around this by having the PHP file in both places. Probably just needs to have a URL adjusted somewhere in the code.

  5. 8

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.