Advertisements

is_sticky

Definition:
function is_sticky( $post_id = 0 ) {}

Check if 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.

Parameters

  • int $post_id: Optional. Post ID.

Return values

returns:Whether post is sticky.

Source code

function is_sticky( $post_id = 0 ) {

	$post_id = absint( $post_id );



	if ( ! $post_id )

		$post_id = get_the_ID();



	$stickies = get_option( 'sticky_posts' );



	if ( ! is_array( $stickies ) )

		return false;



	if ( in_array( $post_id, $stickies ) )

		return true;



	return false;

}

2191

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: