• Resolved dashton

    (@dashton)


    Hi,

    I setup a few category templates to display a few categories differently. I mimcked the main index template because we wanted it to look just like the homepage.

    The page navigation shows up fine at the bottom, but when clicking on page two, three, four, or any page besides the first the posts remain the same as the first page.

    example: https://www.newsrealblog.com/category/feature/

    How can I get it to display the actual posts on page 2, 3, 4 and so on?

    Here is my category template:

    [code moderated as per Forum Rules]

Viewing 7 replies - 1 through 7 (of 7 total)
  • esmi

    (@esmi)

    You could drop a copy of one of your category template files in the WordPress pastebin and post the pastebin url here. Perhaps someone will be able to spot the problem and suggest a solution.

    Thread Starter dashton

    (@dashton)

    Thanks, I went ahead and did that.

    https://wordpress.pastebin.ca/1794952

    esmi

    (@esmi)

    Try replacing:
    $featuredPosts->query('showposts=12&cat=5111');
    with:

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args= array($featuredPosts->query('posts_per_page=12&cat=5111&paged=' . $paged);

    Thread Starter dashton

    (@dashton)

    Thanks for the reply esmi.

    The replacement didn’t work, it was really odd:

    First try – first page had php error
    Second try – first page worked fine, php error when testing second page.
    Third try – first page worked fine, second page replicated first page like the original problem.

    All I did was replace the line recommended 3 different times. I’ve never seen this before, generally if there is an error once, there will always be an error but I had 3 different situations.

    Thread Starter dashton

    (@dashton)

    I went ahead and uploaded the edited file and uploaded to pastebin.

    Any help would be appreciated. I’ve never had an inconsistent issue like this before, but I believe that I’m not doing anything wrong.

    I know that my pageviews are probably suffering because no one can actually view the archive of a category.

    Thanks again.

    Thread Starter dashton

    (@dashton)

    I guess it would help if I linked the pastebin file :0
    https://wordpress.pastebin.ca/1801756

    Thanks,

    Thread Starter dashton

    (@dashton)

    I hate it when I find a similar post with no solution so here it goes:

    Removed the $featuredPosts variable all together and went with a standard loop pulling from a category, I added your $paged code you recommended and got this:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('posts_per_page=12&cat=5400&paged=' . $paged); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    Thanks for the help, it worked for me.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Page Navigation’ is closed to new replies.