Multiple loops and sticky posts
-
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!
- The topic ‘Multiple loops and sticky posts’ is closed to new replies.