WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/is sticky

Description

This Conditional Tag checks if the current post is a Sticky Post meaning the "Stick this post to the front page" check box has been checked for the post. This is a boolean function, meaning it returns either TRUE or FALSE.

Usage

<?php is_sticky($post_ID); ?>

Parameters

$post_ID
(string) (optional) The post ID
Default: None

Return Values

(boolean) 
True on success, false on failure.

Examples

is_sticky();
// When any Sticky Post page is being displayed.

is_sticky('17');
// When Sticky Post 17 (ID) is being displayed.

By using if condition we can displays like below

if ( is_sticky() ) {
     // Sticky post content
} else {
     // normal post content
}

Notes

Change Log

Since: 2.7.0

Source File

is_sticky() is located in wp-includes/post.php.

Related

See also index of Function Reference and index of Template Tags.