Customizing Thesis Theme – Removing Closed Comments Text

thesis theme customization

November 17

On all of my blog theme customization, I routinely turn off comments on specific Pages like Contact and About.  It just seems odd to have comments there, but I guess it’s a personal preference.

I just got the Thesis them and am enjoying playing around with it, but I needed to do a bit of work to bend it to my will.

The Problem

In Thesis, the default theme puts the words “Comments on this entry are closed.” which is fine for a page or post that has had comments and eventually closed them.  But for a page that never has had any commenting, it just seems silly.

Additional note: This can be done in the CSS as well but I wanted to do this without hiding text or setting “display: none” in CSS to avoid the chance of getting dinged by search engines.  This will remove the text from being created in the first place.

The solution

Luckily, we can easily change this in our theme with just a slight change to the scripts.  Even if you’re PHP challenged, you can still make the change by following these simple steps.

First, go to your default Thesis directory (Thesis_16 if you use it out of the box.) and edit the file named comments.php.

Next, locate the section that looks like this:

if (!comments_open()) {
?>
 <div>
 <p><?php _e('Comments on this entry are closed.', 'thesis'); ?></p>
 </div>
<?php
}

(Hint: this begins on line 70 in my version 1.6).  Modify it to add the following text in red:

if (!comments_open() && !is_page()) {
?>
 <div>
 <p><?php _e('Comments on this entry are closed.', 'thesis'); ?></p>
 </div>
<?php
}

Last, save and close the file. That’s it.

Now refresh your page and Voila! no more bunk text.

Please note that this turns off the text on ALL Pages, which you may or may not want.  I don’t usually have any comments on my pages so it works just fine for me but YMMV.

Did you enjoy this article?   Get more of it...

Subscribe:

If want to get more stuff like this, subscribe now and you'll receive the latest updates instantly by email.

Share It:

  • Twitter
  • StumbleUpon
  • Facebook
  • Digg
  • del.icio.us
  • Reddit
  • Sphinn
  • Posterous
  • HackerNews
  • Mixx
  • Propeller

Follow:

Follow Jim (@jimfmunro) on Twitter here.

Become A Fan:

Become a Fan of Jim on Facebook.

You may also enjoy these related posts:

{ 7 comments… read them below or add one }

James December 2, 2009 at 9:37 pm

Hi,
I tried your code, but it doesn’t seem to work for post pages, only for the “home” page, any ideas? I’ve tried custom css with no joy.
James

Reply

Jim December 18, 2009 at 12:49 pm

Submitted on 2009/12/02 at 10:16pm
Hi, thanks for the feedback. It wasn’t designed to work on posts since most of the time I would prefer to notify readers that comments are closed , but if you needed it to work for posts too.

First, you could decide if you ever need it to appear at all, if not just remove the entire first code section above: the whole if-statement, including the curly braces. That way it won’t ever display the text in any case.

If you should only want to prevent it on posts, you can just substitute && !is_post() for the text in red above.

Let me know if that doesn’t work for you!

Reply

Ana Goncalves May 18, 2010 at 4:54 am

Brilliant neat trick! Thank you.

Reply

rachel July 30, 2010 at 9:52 am

Any idea how this works on Thesis 1.7? The above code is not even in the comments.php code. Any help is appreciated!

Reply

Jim July 30, 2010 at 1:06 pm

Yes, it’s much easier in 1.7. You don’t have to touch any code.

Check out my latest post on the subject about how to remove the comments are closed text in Thesis 1.7 (and beyond.) :)

Reply

Aaron August 11, 2010 at 6:28 am

How do I disable comments on posts (using thesis theme) ?

Reply

Jim August 11, 2010 at 9:17 pm

Basic WordPress can handle that for you, just uncheck the Enable Comments option on any post in the Discussion section. Check out this discussion for a few other options: http://wordpress.org/support/topic/turn-off-comments-on-pages-by-default.

I hope this answers your question.

Reply

Leave a Comment

{ 2 trackbacks }