WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want multiple loops on my homepage, however only the first loop shows up. My homepage looks like this:

Template Name: Home
get_header(); ?>
        <!--Four Columns-->
    <div id="content" class="twelve columns">

            <div class="post-box">
                <?php get_template_part('loop', 'land'); ?>

        </div><!-- End Content row -->

        <!-- Row for main content area -->
        <div id="content" class="twelve columns">

            <div class="post-box">
                <?php get_template_part('loop', 'home'); ?>

        </div><!-- End Content row -->

    <div class="tweleve columns.centered">
    <div class="home-title-thoughts">
    <h2>Our Thoughts</h2>
    <div class="row">
    <div class="twelve columns">
    <div class="home-quote">
    <h3 style="margin-top:0px; margin-bottom:0px;">&#8220;Simplicity is the ultimate sophistication.&#8221;</h3>
    <h4 style="margin-top:0px; margin-bottom:0px;">Leonardo da Vinci</h4>
<?php get_footer(); ?>

Here is loop-land:

$grids = 3; //Grids per row

global $query_string; //Need this to make pagination work

/*Setting up our custom query (In here we are setting it to show 12 posts per page and eliminate all sticky posts) */
query_posts($query_string . '&caller_get_posts=1&posts_per_page=9');

if(have_posts()) :  while(have_posts()) :  the_post(); 
//Show the left hand side column
if($counter == 1) :
            <div class="four columns">
                <div class="postimage">
                    <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('home-thumb'); ?></a>
                <h3 style="text-align:center;"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
                <p><?php the_excerpt(); ?></p>

<div class="clear"></div>

//Pagination can go here if you want it.

Here is loop-home

<?php /* Start loop */ ?>
<?php while (have_posts()) : the_post(); ?>
    <!--<h1><?php the_title(); ?></h1>-->
    <?php the_content(); ?>
    <?php wp_link_pages(array('before' => '<nav id="page-nav"><p>' . __('Pages:', 'reverie'), 'after' => '</p></nav>' )); ?>
<?php endwhile; // End the loop ?>

Any ideas on how to fix this?

share|improve this question
Are you referring to the 2 loop templates? You'd need to show the code in those files. – vancoder Apr 22 '13 at 19:01
Please include the loop code in your question. – tfrommen Apr 22 '13 at 19:01
@vancoder I added the loop codes. – drewrowalnd Apr 22 '13 at 19:04
up vote 2 down vote accepted

Because you used query_posts your loop-land template is clobbering the main query. Don't use query_posts. In loop-land do this instead:

$land = new WP_Query($query_string . '&caller_get_posts=1&posts_per_page=9');
if($land->have_posts()) :  while($land->have_posts()) :  $land->the_post(); 

What happens is that query_posts overwrites the main Loop and you loop over that. When you get to the have_posts part of the second loop, the post counter is already at the end. You've already Looped through the posts.

share|improve this answer
Perfect! Thanks. – drewrowalnd Apr 22 '13 at 19:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.