Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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