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: https://develop.svn.wordpress.org/trunk@18211 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood 2011-06-09 11:12:39 +00:00
parent 564d43a7c3
commit 29a53e3eb0
2 changed files with 8 additions and 18 deletions

View File

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

View File

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