Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

On http://wordpress.barrycarter.info/index.php/page/7/ I disabled comments for "USDCAD options vs CADUSD options arbitrage?", but it still has a "Leave a Comment" link.

Clicking the link takes you to http://wordpress.barrycarter.info/index.php/2011/02/25/usdcad-options-vs-cadusd-options-arbitrage-2/#respond where it, of course, shows that you can't leave a comment.

The timeline page correctly does not show the 'comment' link: http://wordpress.barrycarter.info/index.php/2011/02/

How to fix?

share|improve this question
    
What Theme are you using? –  Chip Bennett Apr 27 '11 at 16:50
    
Ahh, I see: TwentyTen. Just a minute; fix coming up. –  Chip Bennett Apr 27 '11 at 16:51
add comment

1 Answer

up vote 3 down vote accepted

In the loop.php template file, you will find this line:

<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>

If you don't want "leave a comment" to display if comments are closed, you can wrap the call to comments_popup_link() in a if ( comments_open() ) conditional, like such:

<span class="comments-link"><?php if ( comments_open() ) comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>

Note: you may also want to check the other loop-foobar.php template files.

share|improve this answer
    
This did the trick, once I realized that line appears in loop.php 3 times! –  barrycarter Apr 27 '11 at 17:09
1  
Might be a good idea to use a child theme to avoid losing changes in future versions. –  John P Bloch Apr 27 '11 at 18:41
    
Always a good reminder, John. I generally assume that a Child Theme will be the method of implementation, but that might not always be a valid assumption. :) –  Chip Bennett Apr 27 '11 at 20:01
add comment

protected by Community Jul 31 '11 at 8:52

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.