Change {0 Comments} Display

Applies to Version(s): Thesis 1

This article refers to the default comments link on the home page (and other multi-post listing pages); see Customize Comments Intro if you’re looking to change the {1 comment… read it below or add one} message on the single post page.

Change Color of Comments Bracket

Place this code in custom.css, replacing #ff0000 with the desired color value:

.custom .format_text .to_comments span.bracket {color: #ff0000;}

Remove {0 Comments} Entirely

Place this code in custom_functions.php:

remove_action('thesis_hook_after_post', 'thesis_comments_link');

Replace {0 Comments} with Custom Link

This code in custom_functions.php replicates the default Thesis code:

function my_comments_link() {
  if (!is_single() && !is_page()) {
    echo '<p class="to_comments"><span class="bracket">{</span> <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> <span class="bracket">}</span></p>';
  }
}

remove_action('thesis_hook_after_post', 'thesis_comments_link');
add_action('thesis_hook_after_post', 'my_comments_link');

This example removes the brackets, and replaces “0 Comments” with “Be the first to comment”:

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

remove_action('thesis_hook_after_post', 'thesis_comments_link');
add_action('thesis_hook_after_post', 'my_comments_link');

Remove Brackets from Comments Link

The thesis_comments_link filter can be used to do this; for example, with this code in custom_functions.php:

// Changes the comment link to exclude brackets

function my_skin_comments_link($link) {
	return "$link";
}

remove_filter('thesis_comments_link', 'default_skin_comments_link');
add_filter('thesis_comments_link', 'my_skin_comments_link');