0

I'm using the following query in my frontpage template:

        <?php $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
        $args=array(
          'paged'           => $paged,
          'category_name'   =>'home,tumblr'
        );
        query_posts($args);

But for some reason, posts that are made sticky in either of these categories do not show up as the first posts in the output of the loop. It seems option is ignored somehow? How can I make sticky posts show up first?

1

DO NOT USE query_posts() FOR CUSTOM LOOPS!

Use WP_Query() instead.

<?php 
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$custom_cat_query_args = array(
    'paged'           => $paged,
    'category_name'   =>'home,tumblr'
);
$custom_cat_query = new WP_Query( $custom_cat_query_args );

By default, ignore_sticky_posts is set to 0, or do not ignore. So, the custom loop should handle sticky posts as per normal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.