Determines whether current WordPress query has comments to loop over.
Source
function have_comments() {
global $wp_query;
if ( ! isset( $wp_query ) ) {
return false;
}
return $wp_query->have_comments();
}
Changelog
Version | Description |
---|---|
2.2.0 | Introduced. |
Basic Example
Example based on Twentyten’s comments.php template: Comments title (and more) is displayed only when comments are available: