Query to display one sticky post followed by regular posts

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?

I’m not super keen on how WP works, but I would guess this line is why you’re not getting stickied posts.

That is what I thought too but the WordPress Codex and http://generatewp.com say to put it to true or 1. I tried setting it to false or 0, still nothing.

No one has any other ideas about this sticky post issue?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.