[英]How to call limit post of author on author page (wordpress)
I want to show author's limited post
titles
on the author page. 我想在作者页面上显示作者的有限
post
titles
。 I'm using the code outside the wordpress loop
to show limited post of author and the code is <?php query_posts('posts_per_page=20'); ?>
我在
wordpress loop
外使用代码来显示作者的有限帖子,并且代码是<?php query_posts('posts_per_page=20'); ?>
<?php query_posts('posts_per_page=20'); ?>
. <?php query_posts('posts_per_page=20'); ?>
。 but its showing recent post and i want only posts from author. 但它显示最近的帖子,我只想要作者的帖子。
How to do this, anybody have idea? 怎么做,有人有主意吗?
use 采用
query_posts('posts_per_page=20&author=$ID');
or use 或使用
query_posts('posts_per_page=20&author_name="admin"');
Sample Code 样例代码
<?php
$the_query = new WP_Query(array('posts_per_page'=>20,'author'=>$put_author_id_here) );
while ( $the_query->have_posts() ) : the_post();
/* display the post as you do in loop*/
endwhile;
wp_reset_postdata();
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.