Remove Comments Closed Text

June 25, 2009 · 8 comments

So I recently acquired the excellent Thesis theme for Wordpress. What separates Thesis from so many other themes out there is its addition of custom hooks and filters for styling. Despite all the things this makes extremely easy, there are a few things that are made needlessly difficult. For example, completely removing comments from pages that use the Thesis Custom Template. While you can turn the comments off in the page settings as shown below, there isn’t a simple hook you can call to completely prevent the comment loop from executing.

Disable Comments On Page

As a result, each of your custom pages have the annoying little blurb at the bottom saying, “Comments are closed on this entry.” A quick Google search will turn up a number of sites that give you instructions on how to hide the comment with CSS using the custom.css file.

.custom .comments_closed p {display: none ;}

While effective, why does this text have to be output at all? There should be a simple way to completely eliminate the comment loop execution. After digging through the Thesis code for a bit, I discovered that there is a way to do this that doesn’t require modifying any of the Thesis core files while still allowing you to use the Thesis Custom Template. The fix simply requires you to add the following lines to your custom_functions.php file.

global $thesis;
$thesis[‘display’][‘comments’][‘disable_pages’] = true;

Voila! Those pesky closed comments statements are completely gone! No need for CSS, no need to create completely new page template, and no need to modify any Thesis core files!

UPDATE (07/06/09):

After playing with Thesis 1.5 a little more, I realized that you can accomplish the same behavior mentioned above through a simple checkbox in the Thesis Options menu. Under the Comments section, you’ll find the following:

Thesis Comments Options

Make sure the “Disable Comments on all pages” option is checked, and you’re all set. So if the code above scared you off, don’t worry. There’s now a solution for you!

{ 8 comments… read them below or add one }

1 Joe July 6, 2009 at 5:07 am

Both your solutions don’t work at all.

2 Chaz July 6, 2009 at 3:46 pm

@joe: I’ve tested both solutions with the most current version of Thesis (1.5.1) and both work. As mentioned in the update, the PHP solution is unnecessary as there is a GUI option that will completely disable comments for all pages. If you’re having trouble, I may be able to assist you if given more information.

3 Ann September 11, 2009 at 10:55 pm

Where would you add this bit of code to Thesis Open Hook? Sorry, I’m new at this. :)

4 Chaz September 12, 2009 at 2:13 pm

@Ann: You actually do not need to add the PHP bit of code to the Thesis open hook at all. As noted in the update above, you can get the same functionality by clicking the “Disable comments on all pages” option under the Thesis Options menu in your Wordpress administration panel. If you want to use the CSS to hide the comments, you would need to add the CSS code listed above to the custom.css file under the Thesis custom directory. If you need more help with this, I’d be happy to try and assist you via e-mail. Just let me know.

5 kc October 13, 2009 at 11:25 am

I checked “disable comments on all pages” along with a couple other edits in Thesis Options, Hit my Big A– save button, refreshed, and the {Comments on this entry are closed} is still there!

6 Paul November 29, 2009 at 5:31 pm

The disable comments on all pages button does disable comments. But it doesn’t get rid of the message “Comments are closed on this entry”. I thought that’s what this article was about.

7 Chaz November 30, 2009 at 12:27 am

@paul: I’m running Thesis 1.5+ (as mentioned above) and the “disable comments on all pages” button both disables page comments and removes the “Comments are closed on this entry” text on every page. This has been tested and is, in fact, how it’s done on this site.

8 Ian Paul Marshall January 30, 2010 at 9:06 pm

Thanks so much! Worked like a charm.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post:

Next post: