Posted on 12 February, 2009 By Kim Woodbridge 63 Comments

How to Remove “Says” From WordPress 2.7 Threaded Comments

The Farmer Says (by bcostin)

Well, you can’t see it on this site because I spent a good chunk of my weekend trying to figure out how to get rid of it, but I’ve come up with three ways to get rid of the word “Says” after the commenters name in WordPress 2.7 threaded comments.

The three methods are:

  • - Setting the display to none in the CSS class
  • - Making the color of says the same as the background color in the CSS
  • - Using the callback function to output the html so you can edit it

On wait – you’re in luck – I do have a screenshot from the WordPress default theme in my testing site.

says

The html output from wp_list_comments creates the Says with the following code:

<span class="says">says:</span>

So, that’s cool – a class named says exists.

The first method is a way to tell the code to not show the class via CSS. You can add the following to your stylesheet.

.says {display:none;}

I did not use this method because it caused alignment of other parts of the comments to be all out of wack. I spent way too much time trying to figure this out and could not track down the problem. Interestingly enough, I have not had the same issues when I’ve set these up for other people so it is possible it will only work properly for me when I’m getting paid to do it. Actually, it’s more likely that I have a css conflict because I mess with it so often.

The second method uses the same class and also gets added to your stylesheet file. This makes the word says the same color as your background so it is basically invisible, although it does still exist. You will use the following:

.says {color:#fff;}

That will make the word Says white, which is my background color. You can set it to whatever color you like. This solution did not work for me either. Most of my comments are in white but my replies as the site author are in green. If you visited my site on Monday you might have noticed the word Says in tiny little white letters on my replies. This solution will work great if all the comments are the same color. I almost removed the green, even though I’ve frown attached to it, until I tried solution #3.

The method that I used was the callback function, which is mentioned in the codex without much explanation and also detailed at ScriptyGoddess.

In comments.php you change

<ol class="commentlist">
<?php wp_list_comments(); ?>

to

<ol class="commentlist">
<?php wp_list_comments('type=comment&callback=mytheme_comment'); ?>

This will call a function from your functions.php file that allows you to control the html output from wp_list_comments. So, add the following to your functions.php file.

<?php
function mytheme_comment($comment, $args, $depth) {
   $GLOBALS['comment'] = $comment; ?>
   <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
     <div id="comment-<?php comment_ID(); ?>">
      <div class="comment-author vcard">
         <?php echo get_avatar
($comment,$size='48',$default='<path_to_url>' ); ?>

         <?php printf(__('%s</cite>
<span class="says">says:</span>'), get_comment_author_link()) ?>
      </div>
      <?php if ($comment->comment_approved == '0') : ?>
         <em><php _e('Your comment is awaiting moderation.') ?></em>
         <br />
      <?php endif; ?>

      <div class="comment-meta commentmetadata"><a href="<?php echo
htmlspecialchars
( get_comment_link( $comment->comment_ID ) ) ?>">
<?php printf(__('%1$s at %2$s'), get_comment_date(),
get_comment_time()) ?></a><
?php edit_comment_link(__('(Edit)'),'  ','') ?></div>

      <?php comment_text() ?>

      <div class="reply">
         <?php comment_reply_link(array_merge
( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
      </div>
     </div>
<?php
        }

The part of this code that I am interested in for the purpose of this article is

<span class="says">says:</span>

By removing that line from the callback function, says will no longer be part of the comment output. You don’t have to remove it. You can change says to another word or phrase.

This code was contained within the comments.php file in versions prior to 2.7 and it was simply a matter of deleting it from the file.

photo credit: bcostin


Related Posts:
  • Adding WordPress 2.7 Threaded Comments to your Theme
  • How to Style a Sticky Post in WordPress 2.7
  • Using Thumbnails for Excerpts Plugin with Query Posts to Make a Custom Sidebar Block in WordPress
  • The WordPress Fetch Feed Function and the Feed Cache
  • How to Add a RSS Feed Without a Plugin Using the WordPress Fetch Feed Function
  • Posted In : Blogging Comments | WordPress Tips
    If you enjoyed this post, please subscribe to my RSS Feed

    Post to Twitter   Post to Delicious   Post to StumbleUpon

    63 Responses to “How to Remove “Says” From WordPress 2.7 Threaded Comments”

    Trackbacks/Pingbacks
    1. Comment Idea: Greet First Time Commentators without a Plugin | Million Clues!
    Leave a Comment
    You may use: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .


    Recent Comments

      • Kim Woodbridge: Hi Dean - Thanks! I'm just glad I got the punctuation right - I've been having a rough week with typos ......
      • Kim Woodbridge: Hi Jim - What's not to love about Mr T?...
      • Kim Woodbridge: Hi - Thanks for visiting! It is funny :-)...
      • Dean Dwyer: Ah the power of the comma. It's April, Fools. Who knew punctuation could be so funny. Thanks for the smile....
      • Kim Woodbridge: Hi Christine - Awesome! Ooh ... something shiny ;-)...
      • Kim Woodbridge: Hi - I wish Twitter lists had started sooner. I've worked on them some but I'm having a hard time finding the time to w...
      • Christine: This has been driving me crazy for... maybe forever! I created too many lists and deleting them was not exactly clear -...
      • Ching Ya: Honestly I can't think of a way to live without lists. :-) Twitter lists, Facebook lists.. all of these have helped me a...