WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] 404 on author page using custom permalinks and pagination (21 posts)

  1. hyperthalamus
    Member
    Posted 8 months ago #

    I have some author pages in my theme (using a modified version of the UDesign theme and the Pagenavi plugin. Pagination works on the blog, but not on the author pages. I'm getting 404's on the author page urls.

    This works:
    http://www.whitelotusclinic.ca/blog/dr-fiona-nd/

    This does not:
    http://www.whitelotusclinic.ca/blog/dr-fiona-nd/page/2/

    Both of these work:
    http://www.whitelotusclinic.ca/blog/
    http://www.whitelotusclinic.ca/blog//page/2/

    Under my permalinks, I have set the following:
    Permalink Settings > Common Settings > Custom Structure
    /blog/%author%/%postname%/

    Where do I start on this? I've seen lots of posts about custom content types, but this is a standard post. I've seen other information on adding custom rewrite rules and endpoints, but I'm thinking there's probably some other standard CMS based solution for this, am I wrong?

    Looking for some direction, thanks for any help!

  2. kbellagio
    Member
    Posted 8 months ago #

    Can you post your query code?

  3. hyperthalamus
    Member
    Posted 8 months ago #

    I apologize for the nightmare answer, but how do I do that?

  4. hyperthalamus
    Member
    Posted 8 months ago #

    The reason I ask, is I'm not sure what the endpoint is, since it doesn't seem to be resolving to author.php, but instead going directly to the 404 page. I'm new to wordpress architecture, so I'm not sure how to get the query or what code would be relevant.

    My biggest problem is I don't know where this redirect is happening.

  5. kbellagio
    Member
    Posted 8 months ago #

    It would be on the author.php template.

  6. hyperthalamus
    Member
    Posted 8 months ago #

    I assume this?

    <?php global $paged;
    	query_posts( array(	'post_type' => 'post', 'author'  => $curauth->ID, 'paged' => $paged )	);
    if ( have_posts() ) :
    	while ( have_posts() ) : the_post(); ?>
    <div class="entry"> <!-- blah blah --></div>
    
    <?php           endwhile; ?>
    <?php           // Pagination
    if(function_exists('wp_pagenavi')) :
      wp_pagenavi();
    else : ?>
    <div class="navigation"> <!-- more html --></div>
    <?php           endif; ?>
  7. kbellagio
    Member
    Posted 8 months ago #

    <?php
    		if ( get_query_var('paged') ) {
    			$paged = get_query_var('paged');
    		} elseif ( get_query_var('page') ) {
    			$paged = get_query_var('page');
    		} else {
    			$paged = 1;
    		}
    		query_posts( array(	'post_type' => 'post', 'author' => $curauth->ID, 'paged' => $paged ) );
    		if ( have_posts() ) : $count = 0; while ( have_posts() ) : the_post(); $count++;
    		?>

    Try this code at the top instead of what you have there (everything above <div class="entry">). Make sure to backup that code though incase it doesnt work. There is another possible solution, but I want to see if this works first.

  8. hyperthalamus
    Member
    Posted 8 months ago #

    Replaced, same result. I tried: /blog/dr-fiona-nd/page/1/ and also got the 404. I think the endpoint isn't resolving because I tried echoing an html comment as the first line of code in author.php and I didn't see that show up on the 404 page, but I did see it via the direct path (so I know the change was propagating).

  9. hyperthalamus
    Member
    Posted 8 months ago #

    k, I tried replacing the entire page with <?php echo "test"; ?>

    and the paginated view still returned the 404... That leads me to think the problem is elsewhere?

    Does this sound correct?

  10. kbellagio
    Member
    Posted 8 months ago #

    Do you have a custom post type set for authors?

  11. hyperthalamus
    Member
    Posted 8 months ago #

    I think what's happening is the permalink is attempting to take the site to a post because of the permalink structure. I think I might need to add a rewrite rule to make this work?

    I'm pretty sure I could construct the regex to detect the redirect, something maybe like:

    /blog/[\w\d-]*/page/[\d]*/

    but what I'm not sure of is how I can pass that information to the author page? Do I redirect to something like path/author.php?page=n

  12. kbellagio
    Member
    Posted 8 months ago #

    Whatever you just did has it working for me now.

  13. hyperthalamus
    Member
    Posted 8 months ago #

    I don't think so.

  14. hyperthalamus
    Member
    Posted 8 months ago #

    interesting, it's not working for me? Is it still working?

  15. kbellagio
    Member
    Posted 8 months ago #

    Well when I click on the author of the post it goes to use the author.php template file but it looks like you are using a page template right?

  16. kbellagio
    Member
    Posted 8 months ago #

    http://www.whitelotusclinic.ca/blog/dr-fiona-nd/

    What page template is this using, if it is using a query in here post that.

  17. kbellagio
    Member
    Posted 8 months ago #

    http://www.whitelotusclinic.ca/blog/author/dr-fiona-nd/

    This is working perfectly fine to me, so it must mean that template you have set up is broken.

  18. hyperthalamus
    Member
    Posted 8 months ago #

    aha! Big blinding flash of the obvious (well, should have been obvious I guess), thanks!

    It's related to the url structure I'm trying to create, I was trying to eliminate the "author" folder and instead use the author name to give the user some context of who's blog they were in from the url without adding the additional characters. Lot of ancient history here that I'm just now remembering. I think this gives me a lot of new stuff to chew on and troubleshoot. Thanks!

  19. hyperthalamus
    Member
    Posted 8 months ago #

    oh, nvm... I was way overcomplicating this, I was thinking that would affect my post urls when it has nothing to do with them. Thanks again.

  20. kbellagio
    Member
    Posted 8 months ago #

    No problem. Make sure to mark this as resolved.

  21. hyperthalamus
    Member
    Posted 8 months ago #

    done

Reply

You must log in to post.

About this Topic