WordPress.org

Make WordPress Core

Ticket #20469: 20469.3.twenty-twelve.diff

File 20469.3.twenty-twelve.diff, 1.1 KB (added by obenland, 6 years ago)
  • wp-content/themes/twentytwelve/comments.php

     
    4545                </nav>
    4646                <?php endif; // check for comment navigation ?>
    4747
    48         <?php // If comments are closed and there are comments, let's leave a little note.
    49                 elseif ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
    50         ?>
    51                 <p class="nocomments"><?php _e( 'Comments are closed.', 'twentytwelve' ); ?></p>
    52         <?php endif; ?>
     48                <?php
     49                /* If there are no comments and comments are closed, let's leave a little note, shall we?
     50                 * But we only want the note on posts and pages that had comments in the first place.
     51                 * It's just the polite thing to do!
     52                 */
     53                if ( ! comments_open() && ! empty( $comments_by_type['comment'] ) ) : ?>
     54                <!-- If comments are closed. -->
     55                <p class="nocomments"><?php _e( 'Comments are closed.' , 'twentytwelve' ); ?></p>
     56                <?php endif; ?>
     57
     58        <?php endif; // have_comments() ?>
    5359
    5460        <?php comment_form(); ?>
    5561