我创建了一个自定义作者页面,其中列出了他们的帖子标题。但问题是,如果分页超出了设置的每页帖子值,我就无法让它工作。我已经将get\\u posts()用于它的自定义循环。
<?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="<?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>\';
}
?>
这应该显示5篇文章的标题和作者的摘录,。。。。但是作者的其余帖子没有分页,它分页的是博客上的全部帖子。