Forums

[resolved] Pagnation on Author Page (7 posts)

  1. wiziology
    Member
    Posted 1 year ago #

    Hey all,

    Im currently working with WP Page numbers and I cant seem to get the author page to work correctly. The page numbers show up ok, but when you go to the next page, you get a 404 error. I believe I'm having a similar problem to the problem here: http://wordpress.org/support/topic/pagination-for-custom-post-types

    Im using a custom theme that I am building from scratch and Im using "pretty links" so links look like: http://clientsite.com/author/username/

    The URL http://clientsite.com/author/username/page/1/ works fine and will take you to the authors first page of posts but http://clientsite.com/author/username/page/2/ renders a 404 error.

    the query im running is below...

    global $wpdb;
    $author_id=$post->post_author;
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args=array('paged'=>$paged,'posts_per_page'=>2, 'author'=>$author_id);
    query_posts($args);

    Any help would be appreciated! Thanks in advance!

  2. wiziology
    Member
    Posted 1 year ago #

    Update:

    Apparently it is also doing the same thing on my "category" pages. A custom articles page I made works fine tho.

    The page isn't currently live, but I can provide a link with a login if need be.

    Thanks again

  3. Mark / t31os
    Moderator
    Posted 1 year ago #

    And if you remove those 5 lines posted above, does the author page then behave correctly?

    Also, are you using an author template? Is that where the code above is being placed?

    :)

  4. wiziology
    Member
    Posted 1 year ago #

    Yes, the author page behaves correctly without the 5 lines posted above and in fact, it even works with the 5 lines. It's just when you go to page 2 that it stops behaving the right way.

    And yes, I'm using an author template, author.php

    Thanks for the help!

  5. wiziology
    Member
    Posted 1 year ago #

    @Mark:

    I unlocked the pages from maintenance mode so you could see what is actually happening.

    http://limelightmich.com/author/hermes/

  6. Mark / t31os
    Moderator
    Posted 1 year ago #

    Perhaps i wasn't totally clear before, when using one of the provided permalink structures, does the second page of posts then list correctly?

    If not, then does the page work correctly with the above 5 lines removed from the author template?

    As far as i can see, and i'm assuming here, there's some issue with the permalink structure you're using or the way you're setting query parameters(or possibly both).

    Additional question:
    Are you using any plugins, have you tested with them disabled?

    NOTE: If testing with plugins disabled visit the permalink settings pages, this will regenerate permalink rules(removing any that may of been added by previously enabled plugins).

  7. wiziology
    Member
    Posted 1 year ago #

    Wow Mark, you are a lifesaver!!

    After changing the permalink settings and deactivating all plugins, it started working. Then changing the permalink settings back to how I had them, everything worked perfectly!

    Thank you so much!

Topic Closed

This topic has been closed to new replies.

About this Topic