Hi, I have a multi-authored blog. How can I display the author-name and author-url at the beginning of all posts EXCEPT the posts written be me(admin)? Please help!
I guess we can do this using CONDITIONAL TAGS.
Hi, I have a multi-authored blog. How can I display the author-name and author-url at the beginning of all posts EXCEPT the posts written be me(admin)? Please help!
I guess we can do this using CONDITIONAL TAGS.
In a loop
<?php
$author = get_userdata($post->post_author);
if ($author->user_login != 'admin') {
echo '<p>Display name '.$author->user_login .'</p>';
echo '<p>URL '.$author->user_url .'</p>';
}
?>Thanks for the quick reply. It's working fine. But I would like to display just one line like:
Guest Post by AUTHOR_NAME (AUTHOR_NAME linking to AUTHOR URL)
Please help!
Please paste the code from template that you are using to display your posts into a pastebin and report the link back here.
My single.php template:
http://pastebin.com/s49gGp3E
<?php the_title(); ?> By <?php the_author_posts_link(); ?>Hey I framed it myself using your loop.
<?php
$author = get_userdata($post->post_author);
if ($author->user_login != 'admin') {
echo '<p>Guest Post by <a href="'.$author->user_url .'">'.$author->user_login .'</a>';
}
?>
Thanks for guiding me! :)
This topic has been closed to new replies.