Thesis Banner

Customizing the Thesis Number of Comments Display

by Chris on April 5, 2010

One question I always get asked is how to change the way Thesis displays the number of comments for a post. By default, Thesis displays the number in curly brackets like this:

{ 0 } comments.

I am personally not a fan of how this looks, but fortunately Thesis makes this extremely easy to customize.

First open custom_functions.php and add this line to the bottom

remove_action('thesis_hook_after_post', 'thesis_comments_link');

This will remove the default Thesis number of comments display. Now to add your own custom look, add the following to the same file.

function custom_comments_link() {
  if (!is_single() && !is_page()) {
    echo '<p class="to_comments"><a href="';
    the_permalink();
    echo '#comments" rel="nofollow">';
    comments_number(__('<span>0</span> comments', 'thesis'), __('<span>1</span> comment', 'thesis'), __('<span>%</span> comments', 'thesis'));
    echo '</a> </p>';
  }
}
 
add_action('thesis_hook_after_post', 'custom_comments_link');

Basically, this is the same code as before, but without the curly brackets. You can then use the to_comments css class to customize the number of comments look to your liking.

No related posts.

{ 3 comments… read them below or add one }

Matt April 14, 2010 at 10:28 am

This is one of my most recommended customizations to make to Thesis for most sites. Although the squiggly comment looks great on some sites, it doesn’t look so great on others. It’s also one of the first things I notice that let me know you’re using Thesis, so changing this can make your site look more unique very quickly.

Nova July 29, 2010 at 4:09 pm

Thanks for lots of great tips on using thesis. I am running with Thesis 1.7 and want to add numbers to each comment but the easy way that thesis gives you on their site (via site options – design options – comments – number comments box) is no longer there in 1.7 so I am unsure of how to do this now. I would really appreciate some help. Many thanks.

Chris July 30, 2010 at 8:55 pm

Hi Nova,

In Thesis 1.7 go to Design Options, and then under the Big Ass Save Button are the Comment Options. Hope that helps!

Leave a Comment

Previous post:

Next post: