is_sticky

FUNCTION wp-includes\post.php (ligne 2862) github
Determines whether a post is sticky. Sticky posts should remain at the top of The Loop. If the post ID is not given, then The Loop ID for the current post will be used. For more information on this and similar theme functions, check out the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ Conditional Tags} article in the Theme Developer Handbook.

Paramètres

Entrée :
$post_id = 0
Sortie :
@param int $post_id Optional. Post ID. Default is the ID of the global `$post`.
@return bool Whether post is sticky.

Utilisation

// Utilisation de la fonction is_sticky
$result = is_sticky($post_id = 0);

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

Actualités

Chargement des actualités...