get_comments_number

FUNCTION wp-includes\comment-template.php (ligne 906) github
Retrieves the amount of comments a post has.

Paramètres

Entrée :
$post = 0
Sortie :
@param int|WP_Post $post Optional. Post ID or WP_Post object. Default is the global `$post`.
@return string|int If the post exists, a numeric string representing the number of comments

Utilisation

// Utilisation de la fonction get_comments_number
$result = get_comments_number($post = 0);

if ($result) {
    // Votre logique ici
}

Actualités

Chargement des actualités...