I'll use have_posts function to fetch messages, how can I filter posts by author name?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
just append ?author=4 to the url
with the 4 being the author ID
Another option would be to just skip posts in the loop that belong to a certain author. Like so:
This would be useful if you are using multiple loops in a page and want to filter out certain users' posts without creating multiple
WP_Query
s.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
Here is an example to only get posts from the user 'wade'
There are a few plug-ins which can do this for you - such as this one
If they don't quite what you want, they should serve as a good starting point for writing your own plugin (which isn't that scary or difficult)