WordPress.org

Make WordPress Core

Ticket #17568: 17568-simplify-with-attachment-comments.diff

File 17568-simplify-with-attachment-comments.diff, 1.7 KB (added by duck_, 7 years ago)
  • wp-content/themes/twentyeleven/comments.php

     
    6363                </nav>
    6464                <?php endif; // check for comment navigation ?>
    6565
    66         <?php else : // this is displayed if there are no comments so far ?>
    67 
    68                 <?php if ( comments_open() ) : // If comments are open, but there are no comments ?>
    69 
    70                 <?php else : // or, if we don't have comments:
    71 
    72                         /* If there are no comments and comments are closed,
    73                          * let's leave a little note, shall we?
    74                          * But only on posts! We don't want the note on pages.
    75                          */
    76                         if ( ! comments_open() && ! is_page() ) :
    77                         ?>
    78                         <p class="nocomments"><?php _e( 'Comments are closed.', 'twentyeleven' ); ?></p>
    79                         <?php endif; // end ! comments_open() && ! is_page() ?>
    80 
    81 
    82                 <?php endif; ?>
    83 
     66        <?php
     67                /* If there are no comments and comments are closed, let's leave a little note, shall we?
     68                 * But we don't want the note on pages or post types that do not support comments.
     69                 */
     70                elseif ( ! comments_open() && ! is_page() && post_type_supports( get_post_type(), 'comments' ) ) :
     71        ?>
     72                <p class="nocomments"><?php _e( 'Comments are closed.', 'twentyeleven' ); ?></p>
    8473        <?php endif; ?>
    8574
    8675        <?php comment_form(); ?>
  • wp-includes/post.php

     
    5555                'rewrite' => false,
    5656                'query_var' => false,
    5757                'show_in_nav_menus' => false,
     58                'supports' => array( 'comments' ),
    5859        ) );
    5960
    6061        register_post_type( 'revision', array(