Support » Fixing WordPress » Pagination using multiple loops?

  • Hi there, i have a doubt with the multple loops and pagination.

    I try to use three loops but my prev and next links it does not work in any, gives back ‘ not found’.

    If anybody can check this image perhaps it can explain to me better

    My code for “the first” is this, here no prob, but I want show only the last post for the category 20.

    <?php if (have_posts()) : // first post cat20 ?>
    <?php $my_query = new WP_Query('cat=20&showposts=1'); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post();
     $do_not_duplicate = $post->ID; ?>
    <div id="post-<?php the_ID(); ?>" class="post firstpost">
    <div class="entry">
    <?php the_content('Continuar leyendo &raquo;'); ?>
    <?php endwhile; ?>
    <?php endif; ?>

    Now Just below i add this:
    And here is where the problem begins. I want to show the last 10 post for the category 1 and include the pagination… but pagination does not work 🙁

    <div class="divider">
    <div class="news">
    <?php query_posts($query_string . "&cat=1");
    while (have_posts()) : the_post(); // loop continue the first post cat1 ?>
    <div class="newpost">
    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
    <?php the_title(); ?></a>
    <?php edit_post_link('*', '<sup>', '</sup>'); ?></h2>
    <?php the_content('Continuar leyendo...'); ?>
    <?php endwhile; ?>
    <div class="navigation"><?php posts_nav_link('','siguientes','anteriores'); ?></div>

    Now the last part is :
    I want to show only the last three post for the category 19 and I use a custom field (url_image) and here… the pagination not work again 🙁

    If it is not possible that it’s in the two parts although is whereupon it works in this part would be perfect.

    <div class="images">
    <?php if (have_posts() ): ?>
    <?php query_posts($query_string . "&cat=19");
    while (have_posts()) : the_post(); //second loop ?>
    <div class="themePreview" id="post-<?php the_ID(); ?>">
    <?php $url_image = get_post_meta($post->ID, "url_image", $single = false); ?>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
    <?php foreach( $url_image as $url_image ) {
    echo "<img class='tmb' src='".$url_image."' alt='' />";} ?>
    <?php endwhile; ?>
    <div class="navigation"><?php posts_nav_link('','siguientes','anteriores'); ?></div>
    <?php else : ?>
    <h2 class="center">Not Found</h2>
    <p class="center">Sorry, but you are looking for something that isn't here.
    <?php endif; ?>

    Thank you very much for your time.

    Atte: People Strange

  • The topic ‘Pagination using multiple loops?’ is closed to new replies.