• I tried to create a multiple loop with different set of css but no matter what I tried, it doesn't work. Here's my code :
    
    <strong>Loop1</strong>

    <?php query_posts($query_string . ‘$showposts=4’); ?>
    <?php while (have_posts()) : the_post(); ?>

    <div class=”article”>
    ” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php post_image(‘attachment’); ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?>

    <p class=”date”><?php the_time(‘D, M j’) ?> <!– by <?php the_author() ?> –></p>
    <p><?php the_excerpt(‘Read the rest of this entry »’); ?></p>
    <p>Comments <?php comments_popup_link(‘(0)’, ‘(1)’, ‘(%)’); ?> · ” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”>Read More</p>
    </div>

    <?php endwhile; ?>
    </div></div>`

    Loop 2

    <div class="mainarticles-sub"><div class="clearfix">
    <?php query_posts($query_string . 'showposts=4&&offset=4'); ?>
    <?php while (have_posts()) : the_post(); ?>
    
    <div class="article">
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php post_image('attachment'); ?></a><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a>
    
    <p class="date"><strong><?php the_time('D, M j') ?> <!-- by <?php the_author() ?> --></strong></p>
    	<p><?php the_excerpt('Read the rest of this entry &raquo;'); ?></p>
    <p><strong>Comments <?php comments_popup_link('(0)', '(1)', '(%)'); ?> &middot; </strong><a class="continue" href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">Read More</a></p>
    </div>
    
    		<?php endwhile; ?>
    </div></div>

    The posts keeps repeating.

    Please advise.
    Thanks in advance

Viewing 5 replies - 1 through 5 (of 5 total)
  • For what you’ve shown, there’s no need to have multiple loops.
    Just add <?php $i=1; ?> before while (have_posts())
    And then, inside the loop:

    <?php if ($i < 5) : ?>
    // code for 4 first posts
    <?php else : ?>
    // code for 4 next posts
    <?php endif;

    and then, <?php $i++; ?> before endwhile;

    Thread Starter akira01

    (@akira01)

    Hi,
    Thanks for the tips but it doesn’t help. Let me explain what I intend to have :

    I want the first row of posts to appear this way
    <div class=”mainarticles-sub”><div class=”clearfix”>
    <div class=”article”>
    POST ONE
    </div>

    <div class=”article”>
    POST TWO
    </div>

    <div class=”article”>
    POST THREE
    </div>
    </div></div>

    Then the second row
    <div class=”mainarticles-sub”><div class=”clearfix”>
    <div class=”article”>
    POST FOUR
    </div>

    <div class=”article”>
    POST FIVE
    </div>

    <div class=”article”>
    POST SIX
    </div>
    </div></div>

    Please advise. Your help on the above is very very much appreciated.

    Thanks in advance

    Thread Starter akira01

    (@akira01)

    Any help would be very much appreciated. I tried all kinds of loop and it just doesn’t work the way I want (as stated in my 2nd post)

    Please advise. Thanks

    Thread Starter akira01

    (@akira01)

    Anyone please, I really need to solve this before my site go live. Now I’m stuck only this part.

    Thanks a million in advance.

    Thread Starter akira01

    (@akira01)

    Can anyone offer your valuable help? I believe wordpress can do this but i just couldn’t figure out how.

    Please advise.
    Thanks in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Multiple Loop’ is closed to new replies.