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_

git-svn-id: http://svn.automattic.com/wordpress/trunk@18211 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2011-06-09 11:12:39 +00:00
parent b385498c11
commit 4360343656
2 changed files with 8 additions and 18 deletions

View File

@ -63,24 +63,13 @@
</nav> </nav>
<?php endif; // check for comment navigation ?> <?php endif; // check for comment navigation ?>
<?php else : // this is displayed if there are no comments so far ?> <?php
/* If there are no comments and comments are closed, let's leave a little note, shall we?
<?php if ( comments_open() ) : // If comments are open, but there are no comments ?> * But we don't want the note on pages or post types that do not support comments.
*/
<?php else : // or, if we don't have comments: elseif ( ! comments_open() && ! is_page() && post_type_supports( get_post_type(), 'comments' ) ) :
?>
/* If there are no comments and comments are closed, <p class="nocomments"><?php _e( 'Comments are closed.', 'twentyeleven' ); ?></p>
* let's leave a little note, shall we?
* But only on posts! We don't want the note on pages.
*/
if ( ! comments_open() && ! is_page() ) :
?>
<p class="nocomments"><?php _e( 'Comments are closed.', 'twentyeleven' ); ?></p>
<?php endif; // end ! comments_open() && ! is_page() ?>
<?php endif; ?>
<?php endif; ?> <?php endif; ?>
<?php comment_form(); ?> <?php comment_form(); ?>

View File

@ -55,6 +55,7 @@ function create_initial_post_types() {
'rewrite' => false, 'rewrite' => false,
'query_var' => false, 'query_var' => false,
'show_in_nav_menus' => false, 'show_in_nav_menus' => false,
'supports' => array( 'comments' ),
) ); ) );
register_post_type( 'revision', array( register_post_type( 'revision', array(