• For the index page on my site I am displaying Uncategorized posts and posts of a particular category called “Gigs”, using two separate loops. I want to be able to use blog pages (limiting a certain number of posts to be displayed per page) with the Uncategorized posts, without affecting the Gigs posts.

    Here’s my code so far:

    <div class="gig_schedule">
    <h4>Gig Schedule</h4>

    <?php query_posts('category_name=Gigs&showposts=10'); ?>

    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>
    <b><?php the_date('F j') ?></b> - <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>

    <?php endwhile; ?>

    <?php else : ?>
    No gigs are currently scheduled.

    <?php endif; ?>
    </div>

    <?php query_posts('category_name=Uncategorized'); ?>

    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>
    <h3><?php the_title(); ?></h3>
    <h4><?php the_date() ?></h4>
    <?php the_content(); ?>
    <p class="cite"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent link for <?php the_title(); ?>">#</a> | Posted by <?php the_author() ?> at <?php the_time() ?> | <?php edit_post_link('Edit','','|'); ?> <?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?>

    <?php endwhile; ?>

    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
    </div>

    <?php else : ?>

    <?php endif; ?>

    Any ideas?

Viewing 11 replies - 16 through 26 (of 26 total)
  • Thread Starter mrd516

    (@mrd516)

    The navigation links do not show up, meaning the navigation div is empty when I view the source code.

    Well, okay. No more question. Nothing else I could use to examine this issue. Wish you luck.

    p.s. make sure you post back if you figure it out ’cause I’m curious what’s the cause of this.

    Thread Starter mrd516

    (@mrd516)

    Another thing I’m noticing is that the posts limit isn’t working quite right either. I’m not sure I’ve identified any particular pattern, it’s just not working how it should.

    This is very strange and even more frustrating. My code is exactly how it is suggested on the Wiki, so why are there so many problems???

    I’m tempted to just forget about the pagination and hard-code the post limit. That seemed to have much fewer problems.

    Another thing I’m noticing is that the posts limit isn’t working quite right either.
    Say, it always grabs 5 posts and only displays category 1 posts. So if there are 5 posts and 2 of them category 1 (the rest other categories), you only see 2 posts. That’s what happen in the 2nd loop.

    I’m having the same issue with the page navigation on the non-single post pages. I’ve tried both types of navigation commands suggested. For a while, with the Kubrick style, I was getting empty divs. Now I get links with the post_nav_links, but when you click on them, it just updates the page with the same posts. I’m sure this has something to do with the double loops.

    I’m having this same problem.

    And I do have the same problem at my homepage with 3 loops. On my archive I do have 2 loops. Here I get a “Previous Entries”-link even it there isn’t any. I’ve been looking quite some time now … but no substantial help.
    This should be a major documented issue for WordPress as I suspect lots of people have multiple loops and want full control over pagination.

    Basically the question is how to get separate pagination for multiple loops.

    If I use 3 loops it would be great if I could use 3 separated working paginations for each. Or more realistically one pagination for one of them (which I want to be able to chose).

    This might be possible, but I’m having trouble to find good documentation.

    ryder22

    (@ryder22)

    did any of you find a solution?
    thanks, R

    kiara

    (@kiara)

    It would be wonderful if someone had figured a solution for this, as I am having the same issue. I’m running 3 loops on my main page, each calling the latest post from one of three authors. This works fine, however, whenever I try to go back a page in pagination or filter by a category, it simply returns me to the same loop. Does anyone have an easy answer for this? (Or I’ll take even a hard one at this point.)

    kiara

    (@kiara)

    Ok, here’s what I figured out for a work-around for my site. Maybe it could be useful to someone else as well. First, I placed all the code for my additional loop(s) in wpLoop.php. Second, I created a “normal” loop file and called it wpLoop2.php.

    Then, I went to my index.php file and used the following code:

    <?php get_header(); ?>

    <?php if (is_home()) { ?>

    <?php include (TEMPLATEPATH . "/wpLoop.php"); ?>

    <?php }else{ ?>

    <?php include (TEMPLATEPATH . "/wpLoop2.php"); ?>
    <?php } ?>

    This code makes the pagination work properly instead of returning to the same old loop. I hope it helps.

Viewing 11 replies - 16 through 26 (of 26 total)
  • The topic ‘Using blog pages with multiple loops’ is closed to new replies.