wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
get_comments_number › WordPress Function
Seit1.5.0
Veraltetn/v
› get_comments_number ( $post_id = 0 )
Parameter: |
|
Gibt zurück: |
|
Definiert in: |
|
Codex: |
Retrieves the amount of comments a post has.
Ähnliche Funktionen: get_comments_number_text, comments_number, get_comment_time, get_comment_meta, get_comments_link
Quellcode
function get_comments_number( $post_id = 0 ) { $post = get_post( $post_id ); if ( ! $post ) { $count = 0; } else { $count = $post->comment_count; $post_id = $post->ID; } /** * Filters the returned comment count for a post. * * @since 1.5.0 * * @param string|int $count A string representing the number of comments a post has, otherwise 0. * @param int $post_id Post ID. */ return apply_filters( 'get_comments_number', $count, $post_id ); }