• I was reading up on the codex, and a few articles on multiple loops that was posted by infovere and ifelse- I may have to do something like this by using the loop several times in pages.

    I’ve used the following example:

    <?php $my_query = new WP_Query('category_name=film&showposts=1'); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    // Do stuff.
    <?php endwhile; ?>

    The result just displays “do stuff” https://reviews.sekhu.net/. What I’m trying to do is call 1 post from each cat for each box. Take into account there is no other code apart from some content and css, nothing more – no loop etc. I would like to use this method, but in this instance use an excerpt with multiple loops? WOuld this work? If so how?

Viewing 2 replies - 16 through 17 (of 17 total)
  • The second one I would think

    Thread Starter jinsan

    (@jinsan)

    Nope that didn’t work either.

    Here’s the code I used:


    <div class="rexcerpt medium box">
    <div class="excerptimage2"></div><div class="excerpttitle">Music</div>
    <h3 class="storytitle" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
    <?php
    $my_query = new WP_Query('cat=3&showposts=1');
    while ($my_query->have_posts()) : $my_query->the_post();
    ?>
    <?php the_excerpt(); ?>
    <?php new WP_Query = $my_query; ?>
    <?phpendwhile; ?>
    </div><!-- Close box3-->

    The error:

    Parse error: parse error, unexpected '=' in /home/jinsan/public_html/reviews/wp-content/themes/boxed_roots/home.php on line 17

Viewing 2 replies - 16 through 17 (of 17 total)
  • The topic ‘Using multiple loops’ is closed to new replies.