• Hey all, first time I’ve posted here as googling hasn’t found the answer for once, I’ve been using the Perishable Press Triple Loop for WordPress which I’ve added an extra loop to.

    At the moment the 2nd, 3rd and 4th loops are all working exactly how I want them to but the first loop, which should display everything is missing the latest post.

    The loop breakdown:
    Loop 1 – Displays everything
    Loop 2 – Displays only posts from category 7
    Loop 3 – Displays only posts from category 8
    Loop 4 – Displays only posts from category 9

    This is all stored locally at the moment so I can’t post a direct link but below is my loop from the homepage.

    If anyone can help me it would be appreciated, or if people know of another solution, I’d love to hear it.

    http://wordpress.pastebin.ca/1856152

    [Code moderated as per the Forum Rules. Please use the pastebin]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Looks like you need to remove line 7:

    <?php while (have_posts()) : the_post(); ?>

    and its corresponding endwhile.

    Thread Starter gazlawn

    (@gazlawn)

    Genius, you are my new favourite person! Thanks!

    Thread Starter gazlawn

    (@gazlawn)

    Another little problem, In the first loop I want to separate the first post to a ‘feature’ div and the remaining posts to simply be a ‘post’ tag, I was thinking of doing this through the loops, but it means that the page nav will only scroll through the first loop.

    The loop breakdown:
    Loop 1 – Displays everything – 9 posts (first styled differently)
    Loop 2 – Displays only posts from category 7
    Loop 3 – Displays only posts from category 8
    Loop 4 – Displays only posts from category 9

    Thanks, and hope this makes sense.

    http://wordpress.pastebin.ca/1856458

    If I understood your problem properly
    you can do this by setting the top post to a sticky then simply edit the css

    .sticky {
    background: #c0d1f1;
    }

    This would give the stickied post a light blue background.
    So it kinda works as a featured post

    Thread Starter gazlawn

    (@gazlawn)

    thats not quite what I’m after, but thanks, ‘feature’ is probably the wrong thing to call it, it needs to be the ‘latest’ post.

    Assuming you want the ‘latest’ div nested inside the ‘span-8’ div, I think you can set up Loop 1 like this:

    <div class="span-8"><div class='latest'>
                <h2>Loop 1</h2>
             <?php if ( have_posts() ) : $counter=0; while ( have_posts() ) : the_post(); ?>
    
                <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                <?php the_excerpt(); ?>
                <?php the_content(); ?>
                <?php comments_template(); ?>
                <?php if (++$counter == 1) echo '</div'; ?>
    
                <?php endwhile; ?>
                <?php posts_nav_link('','','&laquo; Previous') ?><?php previous_post('&laquo; %', '', 'yes'); ?>
                <?php posts_nav_link('','Next &raquo;','') ?><?php next_post('% &raquo;', '', 'yes'); ?>
                <?php else : ?>
                <p>Sorry..</p>
                <?php endif; ?>
          </div>
Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Multiple loop skipping first Post’ is closed to new replies.