“Leave a comment” link even when you can’t

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.

Read More

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

How to fix?

Related posts

Leave a Reply

1 comment

  1. 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.