• Hi,

    I have two loops in a page of my custom theme. For each loop, I use the WP_Query function.

    The first loop displays all the posts from all the categories, and when there are sticky posts, they come on the top of the list. That’s normal.

    The second loop displays four posts from one category only (like a featured category). But when there are sticky posts in this category, i’d like to see them on the top of this section. But currently, they just appears in their normal order (by date).

    This is the code of my second loop:

    <?php
    $args = array(‘cat’ => 3, ‘posts_per_page’ => 4, ‘post_status’ => ‘publish’ );
    $highlights = new WP_Query($args);?>
    <?php while ( $highlights->have_posts() ) : $highlights->the_post() ; ?>
    <!– title, content, image, etc. –>
    <?php endwhile; ?>

    Does anyone know how to force the sticky posts to appear first?

    Any help would be greatly appreciated!

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Same issue here… can anyone help us?

    See if adding ‘caller_get_posts=0’ to the arguments will help.

    $args = array('cat' => 3, 'posts_per_page' => 4, 'post_status' => 'publish', 'caller_get_posts' => 0 );

    Thank you vtxyzzy!
    I added calleg_get_posts to my args as follows:
    $args = array(
    ‘cat’=>’3,4’,
    ‘posts_per_page’ => 5,
    ‘post_status’ => ‘publish’,
    ‘caller_get_posts’=>0
    );
    but still sticky posts don’t show at the top.. :°°

    I wonder if something in your theme, or in a plugin might be interfering. Try switching to the default theme to see if the problem goes away. If not, try disabling all plugins.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Multiple loops and sticky posts’ is closed to new replies.