Support » Themes and Templates » all except Latest from category in Loop

  • this may seem like an odd request, but i want to know how to call all posts except the latest one. i want to know how to do the following…

    loop search for latest post in category (example the featured category); then rewind loop; then search for all posts in all categories, except the latest post from a category (same as before, example noteworthy).

    why would i want to do this? well first i want the latest post from the featured category on top. then display all other posts (including the others from the featured category) below it. but i don’t want the same post to appear at the top and among the other posts (it’ll obviously look weird).

Viewing 2 replies - 1 through 2 (of 2 total)
  • Leads



    I would also like this.

    I want my home page to show the latest post and then underneath have a list of the next 4, 5, whatever posts.

    this comes close;

    <?php query_posts('showposts=5'); ?>
        <?php while (have_posts()) : the_post(); ?>
        <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
        <?php endwhile;?>

    But lists the latest post so it looks a bit funny.




    AH! It’s something called ‘offset’

    This works!

    <ul id="recent-articles">
        $temp = $wp_query;
        $wp_query= null;
        $wp_query = new WP_Query();
        <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
          <li><a href="<?php the_permalink() ?>" rel="bookmark"><span><?php the_time('F j') ?></span> <?php the_title(); ?> </a></li>
        <?php endwhile; ?>
        <?php $wp_query = null; $wp_query = $temp;?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘all except Latest from category in Loop’ is closed to new replies.