Codex tools: Log in
<?php comments_popup_link( $zero, $one, $more, $css_class, $none ); ?>
Displays the comments popup link, using "No comments yet" for no comments, "1 comment" for one, "% comments" for more than one (% replaced by # of comments), and "Comments are off for this post" if commenting is disabled. Additionally, 'comments-link' is a custom CSS class for the link.
<p> <?php comments_popup_link( 'No comments yet', '1 comment', '% comments', 'comments-link', 'Comments are off for this post'); ?> </p>
Hides the paragraph element <p></p> that contains the comments_popup_link when comments are deactivated in the Write>Post screen. Good for those who want enable/disable comments post by post. Must be used in the loop.
<?php if ( comments_open() ) : echo '<p>'; comments_popup_link( 'No comments yet', '1 comment', '% comments', 'comments-link', 'Comments are off for this post'); echo '</p>'; endif; ?>
If you want to load different classes into comments_popup_link(), use the following:
$css_class = 'zero-comments'; $number = (int) get_comments_number( get_the_ID() ); if ( 1 === $number ) $css_class = 'one-comment'; elseif ( 1 < $number ) $css_class = 'multiple-comments'; comments_popup_link( __( 'Post a Comment', 'your-theme' ), __( '1 Comment', 'your-theme' ), __( '% Comments', 'your-theme' ), $css_class, __( 'Comments are Closed', 'your-theme' ) );
comments_popup_link() is located in