Query only sticky posts (without “normal” posts)
-
Hello!
I want to show max. 2 sticky posts on my blog in a specific loop. But if there is only one or no sticky post, the loop shouldn’t show “normal”posts.
But the following code shows “normal” posts if there are not 2 or more sticky posts:
$args = array( 'numberposts' => 2, 'post__in' => get_option( 'sticky_posts'), 'ignore_sticky_posts' => 1 ); $sticky_posts = get_posts( $args );
Thank you a lot in advance!
Daniel
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Query only sticky posts (without “normal” posts)’ is closed to new replies.