REQUIRED: Comments are displayed as "Off" while they aren't in wp-admin. Comment form is not displayed in these cases, while it is when a unit test post already has comments.

i have installed the Test data . and on some post and comment test post pages. these pages had some comments. and there is also a Comment form under all the comments. why it notices me,"Comment form is not displayed in these cases, while it is when a unit test post already has comments."

comments are displayed as "Off" while they aren't in wp-admin, what's this meaning? how to correct it?


OK, I figured it out. It took a bit of digging and many bad suggestions. The solution is actually quite simple. Just replace this in your theme files:

Where you have this:

        <div class="comments">
        <?php comments_template(); ?>

Replace it with this:

        <div class="comments">
            <?php if ( comments_open() ) : ?><br /><p><br /><?php comments_template(); ?><br /></p><br /><?php endif; ?>

Note: I thought this was a little ironic, but if you switch your theme to twenty-eleven (the theme that replaces twentyten in 3.2 Beta) it doesn't remove comments like they suggest you should.

You can replace the other code that you are using for the comments_popup_link with the similar condition like this:

    <div class="comments">
<?php if ( comments_open() ) : ?><br /><p><br /><?php comments_popup_link('0', '1', '%'); ?><br /></p><br /><?php endif; ?>

I'm not sure how the theme review works 100%, but the theme check plug-in says you passed! Here is a screenshot. You Passed Screenshot Good Luck!


I'll try to point you in the right direction, but I'm not 100% sure. I've only been*"Stepping Into Templates"* for a few months (the correct way, not just hacking others themes). I'm sure it is going to be be a conditional statement depending on whether the comments are displayed or not. Since they aren't actually stored on the page, but in their own table of the DB this should be fairly simple. It's a little late tonight/morning, but if this isn't answered by tomorrow I'll try to help you find a solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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