我正在wordpress中为每个创建帖子的作者创建一个 Profiles 页面 . 每个页面 Headers 将等于作者姓名 .
在这个页面上,我希望能够显示'the_content',这将是一些图像和作者的生物,然后是他们的6个最新帖子 .
我想要做的是创建一个查询,显示author_name = the_title的帖子 .
目前我有这个只显示我指定的作者(例如约翰史密斯) .
$author_posts = new WP_Query();
$author_posts->query( array( 'author_name' => 'John Smith', 'posts_per_page' => 6) );
while ($author_posts->have_posts()) : $author_posts->the_post();
//DISPLAY POST CONTENT
endwhile;
1 回答
你可以使用get_the_title()函数 .
请参阅此链接以了解有关get_the_title()函数的更多信息 .
http://codex.wordpress.org/Function_Reference/get_the_title