I have been fighting with this piece of code to get the query to show one sticky post on top if there is one, followed by 6 regular posts. I really want this done with one loop, but so far I have only seen two loops solutions.
<?
global $getnews;
if ( is_user_logged_in() ) { //display post for admins
$getnews = new WP_Query('cat=21&post_status=future&post_status=published&posts_per_page=6&orderby=date&order=DESC');
} else { //display post for visitors
$args = array (
'post_type' => 'post',
'cat' => '21',
'posts_per_page' => '6',
'ignore_sticky_posts' => true,
'order' => 'DESC'
);
$getnews = new WP_Query( $args );
}
?>
The above query in the else brackets shows regular posts only and no sticky on top.
I tried with post__in(); also and with that it only showed the sticky post with no regular post.
Anyone has and idea what I’m doing wrong or if it is even possible what I want to do?