i have created a custom author’s page that list the title of their posts. but the problem is i can’t get the pagination to work if it’s beyond the set post per page value. i have used get_posts() to it’s custom loop.
<?php
$ppp = 5; //set my custom number of post to appear
$uid = $curauth->ID;
$args = array(
'numberposts' => $ppp,
'author' => $uid
);
$authorposts = get_posts($args);
//print_r($authorposts);
if ( count( $authorposts ) > 0 ) {
foreach ( $authorposts as $post ): setup_postdata($post) ?>
<li>
<a href="https://wordpress.stackexchange.com/questions/17473/<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>" class="authorpostlink"><?php the_title(); ?></a>
<?php the_excerpt(); ?>
</li>
<?php endforeach; ?>
<div class="post-nav">
<div class="previous"><?php previous_posts_link('‹ Previous Page') ?></div>
<div class="next"><?php next_posts_link('Next Page ›') ?></div>
</div>
<?php
} else {
echo '<p>No articles by this user</p>';
}
?>
This should display 5 post with it’s title and it’s excerpt by the author,….but the rest of the author’s posts isn’t paginated what it paginates is the whole number of post on the blog.