wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.
get_comments_number › WordPress Function
Od1.5.0
Przestarzałyn/a
› get_comments_number ( $post = 0 )
| Parametry: |
|
| Powrót: |
|
| Zdefiniowane na: |
|
| Codex: |
Retrieves the amount of comments a post has.
Powiązane Funkcje: comments_number, get_comments_number_text, get_comment_meta, get_comment_time, get_comments_link
Źródło
function get_comments_number( $post = 0 ) {
$post = get_post( $post );
$comments_number = $post ? $post->comment_count : 0;
$post_id = $post ? $post->ID : 0;
/**
* Filters the returned comment count for a post.
*
* @since 1.5.0
*
* @param string|int $comments_number A string representing the number of comments a post has, otherwise 0.
* @param int $post_id Post ID.
*/
return apply_filters( 'get_comments_number', $comments_number, $post_id );
}