Removing “Comments are closed” from WordPress

UPDATED! August 5 2012 – I put together a quick video because some people were having trouble working out how to edit php files. See end of post for vid.

This is an issue that has irked many a website designer over time. WordPress is a very flexible and powerful system but, let’s face it, the software was designed by and for blogger fans. And what blogger fans and other “social networking tragics” love more than anything in the world is interaction.

And who can blame them!

But many of us have clients who don’t want or need people commenting on every page and post of their site. So the wonderful WordPress commenting feature becomes a pain in the bottom instead.

Sure, you can “turn off” commenting but you’re still stuck with a pointless confusing statement at the end of every page and post on your clients site saying “Comments are closed” or something similar.

Getting rid of that statement is possible but, unfortunately, a confusing process because each theme or template used by WordPress has the bit that’s responsible placed in different files.

So, you might read somewhere that you just go to “singlepost.php” and delete a line but discover your theme doesn’t have any such file.

Hopefully, this post will help you sort out what in the heck is going on for at least some templates (themes) you and your clients are using.

Here (in no particular order) are some different methods for removing the “comments are closed” text from a WordPress site.  Check your theme for relevant files and then the stated lines within the files. If you can’t find the files and or lines for one solution, try one of the others. Somewhere in here you will hopefully find the right answer for your situation.

Note that these suggestions all assume you’ve already turned off commenting in your site by going into Settings > Discussion in your Admin panel and unchecking the “Allow people to post comments on the article” box.

1. Using the “singlepost.php” and/or “page.php” and/or “”singlepage.php” files

If your theme has one or more of these files included, look for the line

< ? php comments_template(); ? >

Once you’ve found it you have 2 options for stopping it from working.

a) Delete it (not recommended but lots of people do it)

b) Do what’s called “comment it out”. This means you use a bit of simple code to hide it so it won’t work. But if you have any problems it’s easy to remove the “commented out” symbols and restore it back to it’s original state. I just find it a safer method than blithely deleting stuff from the code base.

“Commenting out” looks like this

/*Bit you want to hide*/

Everything between the /* and */ will be ignored as if it’s not there.

2. Using the “comments.php”

In some themes (eg the lovely Amazing Grace) the solution is in the file called “comments.php”. Find the bit that looks something like this:

php else : // comments are closed ?
!– If comments are closed. –>
p class=”nocomments”>Comments are closed</p>

And remove the text that is displaying on your site (the words at the very end in bold). If you’re not sure which bit is the text try putting in a tilda  ~ and see if it shows up on the site. If so, you know you have your culprit and can delete the text for display there. Make sure you leave everything else exactly as it is.

If this option is available to you in your theme praise the designer because it means, if you want to, you can still have comments activated on some of your posts. It doesn’t remove anything except one line of ordinary text that usually displays on your site.

3. Using comments.php part 2 (Leptonhead’s solution)

If you can’t find the above line in your comments.php try leptonhead’s suggestion:

1) Go inside the theme folder through FTP and open comments.php

2) Look in comments.php for something that looks like this:

[div class="messagebox"]
[?php _e('Comments are closed.', 'inove'); ?]

NB “inove” is the name of the theme, so if you are using another theme look for the name of your theme instead. I know that this bit can also be found in the Options theme and Structure theme but not in the Default or Classic theme.

3) Delete/comment out that entire block.

Thanks leptonhead!!

3. Delete the comments.php entirely

I haven’t ever tried this but I have seen it suggested. It seems a bit drastic to me. I will let you know if it works when I get a chance to experiment with it.

Anyone got other suggestions?

4. CSS

And another suggestion from Shu and Jasonfor those who are comfortable using CSS (thanks both of you!)

A “safer” and simpler solution is to hide the text using css:

.nocomments { display:none; }

Please read comments for more information on above solutions – your question might already be answered!

Short video for those of you who don’t know how to edit the files for your theme. Hope it helps you. Let me know!!

This entry was posted in Wordpress tips. Bookmark the permalink.