WordPress Selected posts on home page based on Authors

We can show posts based on only selected authors from wordpress users. For this we can use “query_posts” function. Just Goto Appearance –>  Editor –> select page Index.php and place the below code and see.

Author Parameters

You can also restrict the posts by author.

  • author=3
  • author=-3 – exclude author id 3 posts
  • author_name=Harriet

Note: author_name operates on the user_nicename field, whilst author operates on the author id field.

Display all Pages for author=1, in title order, with no sticky posts tacked to the top:

query_posts('caller_get_posts=1&author=1&post_type=page&post_status=publish&orderby=title&order=ASC');

Leave a Reply

Your email address will not be published. Required fields are marked *

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image