Posted on 12 February, 2009 By 72 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




Keep Reading:
Posted In : Blogging Comments | WordPress Tips

Did you enjoy this article? I can assist you with your WordPress or Facebook project. Contact me and I will provide you with an estimate. You can also connect with me on Facebook or follow me on Twitter. If you are looking for Hosting, WordPress Theme, Newsletter or other recommendations, please view my detailed list.




72 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> .

CommentLuv badge

About

Kim Woodbridge is an accomplished Information and Technical Consultant specializing in the entire implementation of a WordPress based website including installation, theme design, upgrades, unique customizations and ongoing site maintenance.

Recent Comments

    • Property Marbella: Hi Kim, Good article with several good tips, my friend up in Sweden has clothing stores and online sales with little tr...
    • Kim Woodbridge: This post was written 2.5 years ago. At that time people wanted detailed instructions and asked me to write it. And wh...
    • Kim Woodbridge: Pretty much all themes have a page.php file. Are you using a child theme? If so, you will want to look for the page.ph...
    • Mitch: That's why the internet has evolved into a worthless piece of "junk yard". Everybody is repeating the same thing over an...
    • Meredith: This is very straightforward info, and I think it will help, but I have one question. What if I don't have a page.php fi...

Wordpress Services

  • Installation, upgrades and maintenance
  • Conversion of existing html and css templates
  • Theme and plugin recommendations
  • CSS customizations
  • Troubleshooting and tweaks for unique situations
  • Customization for individual blogging goals and needs
  • Training and advice