Forums

[closed] Two Loops integrated - issue (3 posts)

  1. riccardo.malesani
    Member
    Posted 1 year ago #

    Hi, I want to expose an issue concerning the integration of two Loops.
    I have this slider (come from WP Coda Slider plugin), which calls pages:

    <?php query_posts('post_type=page&orderby=title&order=asc'); ?>
    <div class="scrollContainer">
    <?php while (have_posts()) : the_post(); ?>
    <div class="panel" id="<?php echo $post->post_name ; ?>">
    <?php the_content(); ?>
    </div>
    <?php endwhile;?>
    </div>

    and it works great.
    In one page content, I run another php Loop to call the posts list, like this:

    <?php query_posts ('post_type=post&order=desc'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <li><a rel="group_news" href="<?php the_permalink() ; ?>"><?php the_title(); ?></a><?php echo '&nbsp;&nbsp;&nbsp;' ?><?php comments_number('No Comments','1 Comment','% Comments'); ?></li><?php endwhile;?>
    <?php wp_reset_query(); ?>

    And the list is regularly called in that page, in that slider panel to be more precise.

    Unfortunately, posts are also called in next panels of sider, as pages must be, replacing them.
    In short:
    panel 1: page content (ok)
    panel 2: page content (ok)
    panel 3: page content - posts list of second loop (ok)
    panel 4: post content (wrong)
    panel 5: post content (wrong)
    ...

    in panel 4 and 5, I expect to have page 4 and 5 content, not the posts !

    I can't solve this
    thanks a lot

  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    try to use wp_reset_query(); at the end of the slider query as well.

  3. alchymyth
    The Sweeper
    Posted 1 year ago #

    [duplicate: http://wordpress.org/support/topic/two-loops-integrated-issue-1?replies=5
    please continue with your other thread; this one is closed.]

Topic Closed

This topic has been closed to new replies.

About this Topic