January 27, 2019 at 1:50 pm
Hi Ben,
I created custom author pages, where both authors portfolios are displayed and authors posts. I would like to paginate results, but paginate links redirect to homepage, do you know where might be the problem?
Example archive:
*Login to see link e/author/svetlanapolyakova/
This author has 16 pages of portfolios.
I used this code:
<div class="pagination">
<?php
$url = 'https://' . $_SERVER['SERVER_NAME'];
$author = get_the_author_meta('user_nicename', $curauth->ID);
echo paginate_links( array(
'base' => $url . '/author/%_%',
'total' => $wp_query->max_num_pages,
'current' => max( 1, get_query_var( 'paged' ) ),
'format' => $author . '/?paged=%#%',
'show_all' => false,
'type' => 'plain',
'end_size' => 2,
'mid_size' => 1,
'prev_next' => true,
'prev_text' => sprintf( '<i></i> %1$s', __( 'Новее', 'text-domain' ) ),
'next_text' => sprintf( '%1$s <i></i>', __( 'Старее', 'text-domain' ) ),
'add_args' => false,
'add_fragment' => '',
) );
?>
</div>
Thanks!