WordPress.org

Ready to get started?Download WordPress

Forums

Pagination using multiple loops? (1 post)

  1. peoplestrange
    Member
    Posted 6 years ago #

    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
    http://img524.imageshack.us/my.php?image=helpwpjk6.png

    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;'); ?>
    </div>
    </div>
    <?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">
    <h2>Noticias</h2>
    <?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...'); ?>
    </div>
    <?php endwhile; ?>
    <div class="navigation"><?php posts_nav_link('','siguientes','anteriores'); ?></div>
    </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">
    <h2>Imagenes</h2>
    <?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='' />";} ?>
    </a>
    </div>
    <?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

Topic Closed

This topic has been closed to new replies.

About this Topic