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.
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
Ben Barden - Blog Tips says
Says you! ;)
Ben Barden – Blog Tips´s last blog post – Where are all the bloggers? 10 possibilities
Kim Woodbridge says
Hi Ben – LOL :-)
alex says
Hi Kim –
How did you format your date, time?
Kim Woodbridge says
Hi Alex – I haven’t done anything to the date and time other than set the font size.
Jim says
Hey, that’s me! Well, under my alter ego.
The comments look awesome, Kim. You’ve done a great job. :-)
Jim´s last blog post – Bavaria Filmplatz, Here I Come!
Kim Woodbridge says
Thanks Jim – I forgot you used to use a pseudonym until I grabbed that screenshot off my test server.
Chinese Girl says
Why it is so important to delete the word “says” in the first place? Sorry I did not get the point of benefit.
Chinese Girl´s last blog post – Ramada Nanjing
Kim Woodbridge says
Hi – You raise a good point – I did not clarify that in the article. The wp-list_comments function outputs the html and “says” is included. What if I don’t want that word or I want it to say something else? It’s kind of an issue of control over what my site looks like.
Ben Pei says
Yeah I guess its more of a customization issue than anything else..
Ben Pei´s last blog post – What Kind Of Blog Design Annoys You?
Carla says
I tried to change the color to white but then the CSS code would show up in the comments.
I removed the word “says” and got this http://greenandchic.com/blog/products/giveaway-erbaorganics-baby-lotion/#comments
The alignment is still good. How does it look on your end
Carla´s last blog post – Giveaway: Erbaorganics Baby Lotion
Kim Woodbridge says
Hi Carla- Well I saw you over on twitter already but you did a great job – it looks wonderful.
Raju says
I *says* Thanks :D
Raju´s last blog post – [Twitter Tip] 2 Ways to Add Twitter Counter to Your Blog
Kim Woodbridge says
Hi Raju – You are truly cracking me up today – between this comment and “Stratos standing behind you.” :-)
Nihar says
Great! Now there is no says :)
I have a call back right now for threaded function. But, didn’t think of removing says. Now, i may remove it.
Great post!
Nihar´s last blog post – How to Merge Multiple PDF Documents for Free
Kim Woodbridge says
Using that callback will allow you to add and remove a number of things. Removing Says isn’t such a big deal it was more the
principle behind it. Are you using any functions to separate trackbacks
and pingbacks from the rest of the comments? I was thinking about
writing an article on that topic.
Shirley says
Great tut. Yes, I figured this out a little while ago when I first started toying around with threaded comments (which I removed).
I like the new use of the callback function within the functions.php file. It makes it easier to add additional customization without really having to edit any core theme files.
As for the use of CSS, that is quite clever. As more of a programmer than a themer, my first instinct is to hack at the code. I only play with CSS when that is the only approach to something. :-)
Shirley´s last blog post – Google AdSense vs. Affiliate Marketing Programs
Kim Woodbridge says
Thanks Shirley! Yeah, I just thought adding in a line of css would
be easier than the whole function. It was the lazy solution ;-)
And if you had written a tutorial it would have saved me a lot of head banging – LOL :-)
Trey - Swollen Thumb Entertainment says
The blogosphere needs more posts like this. I like the mindset of trying to have control over your blog, and knowing how to do all these things.
Trey – Swollen Thumb Entertainment´s last blog post – Stephanie Meyer: Author of Twilight
Kim Woodbridge says
Hi Trey – Thank you for visiting and commenting. I’m glad you liked the tutorial. Removing the word “says” isn’t so important but I had to figure out how once I discovered that it wasn’t as simple as removing it from the template. Perhaps I’m a little obsessive ;-)
Arun | BE Folks says
Great work!! you hack plugins?? anyway i dont use that plugin but its useful to know it..
Arun | BE Folks´s last blog post – How to avoid get rich scam sites
Kim Woodbridge says
Hi Arun – It isn’t a plugin. It’s a function that can be added to
functions.php and edited. I suppose it works similar to a plugin.
Arun | BE Folks says
Yeah. you’re right
Arun | BE Folks´s last blog post – How to avoid get rich scam sites
Arun Basil Lal says
Kim,
There is a much easier workout for this.
For that you have to edit the original wordpress.
1. Find the file comment-template.php in wp-includes folder of your wordpress installation.
2. Open it in a editor like Notepad++ and go to line 1226 (or simply search for ‘says’). You will find the ‘says’ word there.
3. Delete it and you are done!
Infact I just wrote a post on editing the file and displaying custom messages to first time commentators. This is funny that I came here and found this post the very same day I wrote it!
Its here : http://tr.im/hellocommentator
i am new here and I loved your blog!
Cheers
Arun Basil Lal
Arun Basil Lal´s last blog post – Greet First Time Commentators without a Plugin
Kim Woodbridge says
Hi Arun – Thank you for visiting and commenting. I’m aware of that
solution. I prefer to avoid editing the core files because I will need to
redo my edits every time I upgrade. But it’s definitely the 4th way to do it.
Odzyskiwanie Danych says
Changing the color to white seems like the best idea. You don’t need to mess too much with it and you can easily change it back whenever you want and the effect is the sam – noone sees the “says” part of comments.
Kim Woodbridge says
Hi – That is definitely an easy solution but I couldn’t do it because I have
the author comments in a different color – it would work, however, for many sites.
Peter Hinton says
Hi
Cheers for the information, changing the functions.php worked a treat
Kim Woodbridge says
Hi Peter – Great! I’m glad it worked – no more says :-)
Madmouse Blog Tips says
I like the idea of removing “says” and that is easy enough. I would be careful of making the text the same color as the background, it falls into the backhat area of hidden text.
Madmouse Blog Tips´s last blog post – Introducing the “Blue Cheeze” WordPress Theme
Kim Woodbridge says
Hi – That’s a good point – I hadn’t considered that. Will one word get you
into trouble?
Madmouse Blog Tips says
I really don’t know if one word could trigger the search engines to flag it, but it probably isn’t worth the risk.
Madmouse Blog Tips´s last blog post – Introducing the “Blue Cheeze” WordPress Theme
Jeff says
Nice post…found it by wandering the web to see if there was a simpler way to change the stupid “says” to something else, as it was prior to 2.7…guess I’ll be diving into the callback function. Overall, I do really like the new comment features of 2.7 but this is an annoying way to have to change something that should be simple to modify.
Kim Woodbridge says
Hi Jeff – It really is a little ridiculous to go to so much trouble to change one word. At least the callback function worked the first time I tried it ;-)
Anniken says
Gaaaah I’m going nuts. The callback function doesn’t work for me, i get an error message saying there’s something wrong in my functions.php file after I’ve added the comment-stuff.
Anyone knows what I’m doing wrong?
Anniken´s last blog post – Mer finvær
Kim Woodbridge says
Hi Anniken,
You might be putting it in the wrong place or interfering with code that’s already in the functions file. Are you putting it at the end or the beginning? And have you added the call to the function in the comments file?
Anniken says
I tried all over the place. Here’s my functions.php, where would you put it? :
‘sidebar1’,
‘before_widget’ => ”,
‘after_widget’ => ”,
‘before_title’ => ”,
‘after_title’ => ”,
));
register_sidebar(array(‘name’=>’sidebar2’,
‘before_widget’ => ”,
‘after_widget’ => ”,
‘before_title’ => ”,
‘after_title’ => ”,
));
?>
Anniken´s last blog post – Svømme og klatre-bilder
Kim Woodbridge says
Hi – It looks like it should go before the last ? >
Rebecca says
I have 2 comment templates – comments.php and comments2.php – how can i use the funcitons code you gave (thank you!) for just comments2.php. Thanks so much for your help!
Kim Woodbridge says
Hi Rebecca – Are both of those files being used? Do you know why there
are two comment files? If comments2 is set up the same as comments
the code should work the same – the function is being called from the
comments file – not the other way around.
jeff says
thank god for this posting!
I have looked at so many blogs and not one single one of them has explained things so clearly and easily like you have done.
Seriously, some of those blog posters need to be shut down.
they just post up random pieces of code and don’t really explain what to do.
Thanks for explaining how to get rid of the “Say” bit.
I’m glad i found your blog, bloody fantastic i must say!
jeff says
and also, thanks for explaining the callback function. i was going nuts trying to figure it out!
in the wordpress 2.6, it was a matter of just going in and deleting the say line, but obviously since all that loop has gone, we needed the function!
thanks for finally helping me complete my job!
Kim Woodbridge says
Hi Jeff – Thanks! And I completely know what you mean – frequently
those articles are written for other coders. It took me forever to figure
all of this out after I found the code I needed.
Marko Randjelovic says
Kim, thank you so much for sharing this! :)
I wanted to change the date format in my comments and remove the hyperlink and the “at xx:xx” time bit. Then I found this post and realized that I don’t want the “Says:” text either. :)
Now I can style my comments anyway I like. :D
Thank you!
Kim Woodbridge says
Hi Marko – Thank you! I’m really glad the tutorial helped you out – who would have thought that removing the word “says” could be so much work ;-)
Marko Randjelovic says
Hi Kim,
I guess they wanted to make working with comments easier for people who are new to WordPress (like myself). And people who want complete control will find a way to customize it completely. :)
Thanks!
Lauren says
This doesn’t work in 2.8, adding the code to the functions file breaks the site. Something changed in between versions.
Kim Woodbridge says
Hi Lauren,
Are you sure the code was added properly? I’m using it on 2.8 sites without any problems.
neologaN says
Hi there!
In my comments.php i have the following:
‘Reply’)) ; ?>
In order to add:
type=comment&callback=mytheme_comment
how do i do it? I’m no good with php so i just do not know how to combine the two.
Thanks!
neologaN says
whoops, the code didn’t show up, it should be:
php wp_list_comments(array(‘type=comment’,’reply_text’=>’Reply’)) ; ?
Kim Woodbridge says
Hi – You don’t want to add it to reply but rather to this part
wp_list_comments
Filemon Salas says
Thanks a lot! It helped me a lot!
Kim Woodbridge says
Hi Filemon – Great! I’m glad it helped.
Mustafa says
Thanks for the tip Kim! However, as previously mentioned the code is breaking the newer versions of WordPress. I think it has to do more with your site than anything else.
You can see that there are problems with the code:
There should be a ? before php.
The “<" and ?php should be together on the same line.
I think it would be best if you uploaded a text file with the full code instead of outputting it via a pre tag.
Kim Woodbridge says
Hi Mustafa – Thanks for letting me know. I will come up with a better way to present the code.
i says
Im with 2.9.1 and in Default theme in comments.php there is no “says” or display, nothing
Kim Woodbridge says
Does “says” show up in the comments? In 2.7 says didn’t show up in comments.php either so it wasn’t possible to remove it straight from the file and this is why I used these methods instead.
i says
I did as Arun Basil Lal wrote:
1. Find the file comment-template.php
and removed the “says”
Thanks for the answer.
shelly says
Doesn’t work for me on 2.9.1 — it used to work at some point, now it’s either error messages or the word “says” stays. I can’t believe the waste of time this is turning out to be.
Kim Woodbridge says
Hi Shelly – It could be a variety of things causing the problem. I originally set this up when using 2.7.1 I have upgraded to each version and am now running 2.9.1 and am not having any problems with the code.
Ryan says
I have no training in html or CSS, no education whatsoever but I followed your instructions closely enough and met success, modifying for my own theme.
I needed only a single step (after reading along chain of instructions from the comments_php file through the functions_php file), I went to:
/wp-content/themes/genesis/lib/functions/comment_functions.php
and deleted:
says:
…and met success. The earlier steps that Kim directs you to were already in place in the Genesis theme but I don’t know how that relates to default or any other themes.
I am learning as I go – as a writer learning WP in order to blog, rather than a programmer or WP-guy writing a blog – that there are more and more solutions to problems as these tools become more developed and more people use them.
My thanks out to Kim for sharing this, and to all those that helped her arrive at this solution. This was very helpful.
Kim Woodbridge says
Hi Ryan,
Thank you! And I’m really glad you are using a theme that made it so much easier to remove the word says :-)
JesC says
OMG… thank you, Thank You, THANK YOU!!!! I’ve been beating my head on the desk all night trying to figure out how to get rid of that stupid thing. This is the ONLY tutorial I’ve been able to find on it. Thank you so much!
Kim Woodbridge says
Hi JesC – Great! I’m glad it helped. I had found other tutorials that were hard to follow so I wrote this one up.
Udegbunam Chukwudi says
I’d love to remove the date completely. Any tips regarding that will be very much appreciated ;-)
Kim Woodbridge says
Hi Udegbunam,
In this example, the date is the link to the comment. You would want to remove this part
<a href=”<?php echo
htmlspecialchars
( get_comment_link( $comment->comment_ID ) ) ?>”>
<?php printf(__(‘%1$s at %2$s’), get_comment_date(),
get_comment_time()) ?>
You might also want to make something else the link – if I need to link directly to a comment I use the date link.
Udegbunam Chukwudi says
Thanks for the help but I don’t have the above in my comments.php. Looks like my theme’s comment.php is the new one since wordpress 2.7 with threaded comments and all that stuff.
Kim Woodbridge says
Hi – Then your theme probably has a function for comments in the functions.php file. There would be a similar line in there. That’s where the twenty-ten theme has it – there is a line that looks like this
<a href=”<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>”>
<?php
/* translators: 1: date, 2: time */
printf( __( ‘%1$s at %2$s’, ‘twentyten’ ), get_comment_date(), get_comment_time() ); ?>
I recommend being careful and making a backup before editing the functions file.
Udegbunam Chukwudi says
Thanks for the tip. I’ll look into the function.php file as you suggested ;-)
Ajith Edassery says
Kim,
Just found this post while searching for removing topics related to strange irrelevant text reported by Google webmaster tools. My post was on SEO though for the method explained here using callbacks is very good. Linked from my post…
Kim Woodbridge says
Hi Ajith – It’s always fun when you do a search and get hits on articles by people you know.
Guido says
Great..thank you very much! ;)