• Resolved mstg2000

    (@mstg2000)


    I’m looking to list my loop in two different styles on my index.php
    one just under the other. I found an article on multiple loops, but i’m finding it confusing and can’t get it to work.

    I have my primary loop in an external “the_loop.php” (seen here)
    I have my secondary loop in an external “the_archive_loop.php” (seen here)

    So.. I’m looking for..

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php include("the_loop.php"); ?>
    ~line break~
    <?php include("the_archive_loop.php"); ?>
    <?php endwhile; ?>

    No specific category, just latest posts, no duplicates
    any easy fixes?

Viewing 1 replies (of 1 total)
  • Thread Starter mstg2000

    (@mstg2000)

    Never mind! Solved myown problem..

    <?php if (have_posts()) : ?>
    		<?php $my_query = new WP_Query('posts_per_page=6');
    		while ($my_query->have_posts()) : $my_query->the_post();
    		$do_not_duplicate[] = $post->ID ?>
    			<?php include("the_loop.php"); ?>
    		<?php endwhile; ?>
    			<!-- Do other stuff... -->
    			<?php if (have_posts()) : while (have_posts()) : the_post();
    		if (in_array($post->ID, $do_not_duplicate)) continue; ?>
    		<?php include("the_archive_loop.php"); ?>
    	<?php endwhile; endif; ?>
Viewing 1 replies (of 1 total)

The topic ‘Multiple Loops & Styles’ is closed to new replies.