Make WordPress Core

Changeset 18211


Ignore:
Timestamp:
06/09/2011 11:12:39 AM (13 years ago)
Author:
westi
Message:

Only show Comments are Closed when they are supported.
Tidy up the logic to be clearer.
Mark attachements as supporting comments.
Fixes #17568 props duck_

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentyeleven/comments.php

    r18117 r18211  
    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
  • trunk/wp-includes/post.php

    r18083 r18211  
    5656        'query_var' => false,
    5757        'show_in_nav_menus' => false,
     58        'supports' => array( 'comments' ),
    5859    ) );
    5960
Note: See TracChangeset for help on using the changeset viewer.