• Resolved ashworth102680

    (@ashworth102680)


    I have a custom page template that’s being assigned to a page. In short, a link elsewhere in the site will link to this page /more-articles/?id=[some-cat-id]

    The results appear to be pulling correctly, but for some reason I cannot figure out why pagination isn’t working right.

    According to $wp_query->max_num_pages; (which results to 0) there should be one page of results for a query I’m testing with, but that’s wrong. There are 6 results with 5 items per page, so there should be 5 results on the first page and 1 result on the second page.

    I do see a link to see the other page, but when I click it, I see a second page with the same results as the first page. Weird!

    Here is the code for this page in hopes that it will help figure this out:

    https://pastebin.com/wRSM6kSV

Viewing 5 replies - 1 through 5 (of 5 total)
  • Try replacing:

    <?php query_posts('show=5&cat='.$_REQUEST['id']); // show posts from the "clicked from" category page ?>

    with:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('show=5&paged='.$paged.'cat='.$_REQUEST['id']); // show posts from the "clicked from" category page ?>
    Thread Starter ashworth102680

    (@ashworth102680)

    Firstly, thanks for your help. I don’t know if I could learn as much tinkering with things if we didn’t have such an active community ??

    This gets me through different pages now, but it’s pulling all articles from all categories instead of just the one I’m passing through. I have updated the code:

    https://pastebin.com/vfHCY9rM

    Thread Starter ashworth102680

    (@ashworth102680)

    I notice once I dropped the above code in it doesn’t seem to get simple things like <?php single_cat_title(); ?> anymore on the page. It looks like what you typed should work, but it actually un-does other things on the page for some reason. I wonder what’s happening LOL

    Thread Starter ashworth102680

    (@ashworth102680)

    Found the issue. You forgot the “&” before cat ??

    Thanks! Once again you guys have bailed me out.

    Sorry about that.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Pagination doesn’t seem to be working?’ is closed to new replies.