Wordpress: Match custom field to page title and display related posts
I have a custom field named article_author. It is used to display the name of the author. Many different users upload articles on behalf of the authors.
All authors have a page with their details, bio etc on it.
I would like to display the latest 5 posts by the author on their bio page by matching the 开发者_StackOverflow中文版page title to the custom field.
I have no idea how to go about doing this, I have searched the web for weeks but still no luck. I am new to php and wordpress.
Would appreciate any help you guys can offer.
Many thanks
How did you set up the bio pages? Are they using author.php ? Have you added the authors to the site as users?
If so you can assign the posts the author has written to their user, this way when the author.php template is loaded, the loop will already contain their latest 5 posts.
E.g., if you have a user called 'Steve' and assign two posts to him, when visiting http://www.yourwebsite.com/author/steve/ - this will load up the author.php file from your theme
More details on Author Templates here: http://codex.wordpress.org/Author_Templates
精彩评论