Skip

please help me hide comments in latest version of WP using a child theme of twenty ten!
September 2, 2012 7:33 PM   Subscribe

I'm creating a web site for a non-profit using WordPress. I know some CSS (and can figure out most of the basics), but I'm using a child theme based on Twenty Ten and one stupid small thing is bugging me: I've turned comments off for posts and pages that don't need them, but I still get the "comments are closed" message. How do I make it go away?

I tried a CSS fix (doing a nocomments class display none, which didn't work), I googled and found lots of outdated potential solutions. This one seems closest to what might work, but the code has clearly evolved, and trying that one doesn't seem to help either.

I know that function shows up in comments.php, and I found some examples of how to modify that file, but my understanding is that you shouldn't modify parent theme files directly, but use templating to somehow call your modified version of the file. But it's not clear how I do this.

Is there something I put into my functions.php file to call the modified version of comments.php that I put into my child theme directory? Or do I edit it from Appearances > Edit > Comments like in that example above?

tl:dr = I want to hide "comments are closed" for posts and pages where comments are disabled, but not strike them from where they are in use. How do I do this without going insane?

I'm hoping someone out there can help me!
posted by canine epigram to Computers & Internet (9 answers total) 2 users marked this as a favorite
 
You can copy the comments.php file from the 2010 theme folder into your child theme's folder. From there you can edit it as needed, and WordPress will use that comments.php file instead of the parent theme's version.
posted by backwards guitar at 7:46 PM on September 2, 2012 [1 favorite]


I usually just remove the whole PHP statement that refers to the comments template. In my actual Twenty Ten theme, it looks like this:

<?php comments_template( '', true ); ?>
posted by lgandme0717 at 9:28 PM on September 2, 2012


Oh, whoops, just saw that you are using comments on some pages/posts. I believe you can edit comments.php to change (or eliminate) the message that displays when comments are closed.
posted by lgandme0717 at 9:29 PM on September 2, 2012


Clearly there is a conditional set up in a php file (typically comments.php) that tells the page to echo "Comments are closed" whenever comments aren't allowed in a post. You should be able to find that pretty easily and just comment out whatever you don't want.

If you have a link I'd be happy to look at it, to see if this is doable via CSS.
posted by phaedon at 11:24 PM on September 2, 2012


Yeah, that is in comments.php. Just replace the words with a space if you're not comfortable eliminating thephp statement itself.
posted by maxwelton at 11:56 PM on September 2, 2012


Okay, did some more digging, now that you helped me confirm that I was doing the templating right, and figured out the crux of my issue: I'm using the Blog in Blog plugin (to have posts on pages).

So I need to modify the blog_in_blog.php file in the plugin directory (in the same way as I've modified the comments.php file). But if I do that, it will just be overwritten when the plugin upgrades right? Is there a way to do that similar to templating, so it doesn't get overwritten?
posted by canine epigram at 5:54 AM on September 3, 2012


You're right, if you edit blog_in_blog.php, then you lose the existing way it's supposed to work, and if there is an update it will get clobbered.

Now it looks like Blog in Blog has considered that people might want to template how they'd like, and say:
Important: In previous versions of the Blog-in-Blog plugin you might have edited bib_post_template.tpl. If you are upgrading, we will copy this to a textbox so you can edit the template from the plugin page. The bib_post_template.pl file is no longer used and may vanish in a future release.
Does that apply to your situation? Do you have the latest version (1.1.1) of the plugin?
posted by artlung at 6:50 AM on September 3, 2012


I do have the latest, but when I looked in the code for that template, there's only this template tag:
%post_comments%
which I think represents a comments link. I don't know what could be done in the template file, because the actual code around showing "Comments are closed" is in the blog_in_blog.php file itself.
posted by canine epigram at 12:24 PM on September 3, 2012


I'm not 100% convinced where that text is coming from. You need to identify where that text really is. It may be in your theme, or in the parent theme, or it may be in the default comments.php (explained here). I don't *think* it would be in the BiB plugin, but at this point it's hard to say.
posted by artlung at 3:37 AM on September 4, 2012


« Older Spiders! How to get rid of th...   |  Asking for a friend: How shoul... Newer »
This thread is closed to new comments.


Post