I’m trying to link a to 3 different authors by author ID to their author page.
- (author/adrian-cole/)
- (author/steve-helme/)
- (author/scott-oneill/)
How would I go about doing this?
Example:
<div>Adrian Cole <a href="<?php get_author_posts_url(get_the_author_meta('ID')==1) ?>">Read more</a></div>
<div>Steve Helme <a href="<?php get_author_posts_url(get_the_author_meta('ID')==2) ?>">Read more</a></div>
<div>Scott O'Neill <a href="<?php get_author_posts_url(get_the_author_meta('ID')==3) ?>">Read more</a></div>
This will be in the sidebar.php file as “profile widgets” so the author ID can’t be grabbed from the author who published the post
Im guessing this wont be in the loop? am wrong? Im new to wordpress ha!
the wordpress functoin get_author_posts_url($id) returns the url you need.
Something like this should work:
where 1, 2, and 3 are the author ids of your authors.
EDIT: You are right in assuming this falls outside “the Loop”. If you don’t know the IDs of the authors, you can get them in this way: http://wordpress.org/support/topic/getting-user-id-from-username