如何按作者过滤博客文章? [英] How can I filter blog posts by author?
本文介绍了如何按作者过滤博客文章?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将使用 has_posts 函数来获取消息,如何按作者姓名过滤帖子?
I'll use have_posts function to fetch messages, how can I filter posts by author name?
推荐答案
您可以编写自己的查询以包含或排除作者的帖子此页面包含有关可以传递给查询的不同选项的文档.http://codex.wordpress.org/Template_Tags/query_posts
You can write your own query to include or exclude posts from an Author This page has documentation about the different options you can pass to a query. http://codex.wordpress.org/Template_Tags/query_posts
这是一个仅从用户wade"获取帖子的示例
Here is an example to only get posts from the user 'wade'
$author_query = new WP_Query('author_name=wade');
这篇关于如何按作者过滤博客文章?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文