• Resolved earthshaver

    (@earthshaver)


    I inserted a custom-loop in my template and the custom-loop would display 4 random entries. Everything went smoothly until used a sticky post. The custom-loop which should displayed only 4 entries now displayed 5 entries which messed up the design.

    Can anyone tell me how to exclude sticky post from custom loop?

    oh… and here’s my custom-loop code:

    <div id="random-posts">
    <?php
    $my_query = new WP_Query('orderby=rand&showposts=4');
    while ($my_query->have_posts()) : $my_query->the_post();
    ?>
    
      [SOME STUFF]
    
    </div><!-- #random-posts -->
    
    <?php endwhile; ?>
    <?php wp_reset_postdata(); ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How can I exclude sticky post from custom loop?’ is closed to new replies.