I have a script that I have somehow managed to create (since my knowledge of php is very limited) that basically places author's profile (image, bio, and links to social media) on to authors archive page with all the posts by same author.
the problem with this script is it returns empty href's and src's in the div's if inputs in the authors profile are empty. I understand the reason why it does this, but I do not know how to correct it.
the second problem is if author set up a custom image link that my script returns that image, but what also like to do in case if input for that link is empty is to return an avatar.
Here is my script
/***********************************************************
******************* Custom Author Page *********************
***********************************************************/
function author_info() {
if (is_author($avatar, $id_or_email, $size, $default, $alt)) {
if(get_query_var('author_name'))
$author = get_userdatabylogin(get_query_var('author_name'));
$authorID = $author->ID;
$custom_avatar = get_the_author_meta('imageurl', $authorID);
if ($authorID=="1")
echo ' ';
else
echo '<div class="author_profile author_'. $authorID .'">
<div class="author_avatar"><img alt="Author" src="'. $custom_avatar .'" width="140" height="140" /></div>
<div class="author_info">
<div class="author_description">
<p>'. get_the_author_meta('description', $authorID) .'</p>
<p><strong>Author\'s Website:</strong><a href="'. get_the_author_meta('user_url', $authorID) .'">'. get_the_author_meta('wesitename', $authorID) .'</a></p>
</div>
</div>
<div class="author_links">
<a href="https://plus.google.com/'. get_the_author_meta('google_plus', $authorID) .'" rel="me" target="_blank"><img alt="Google Plus Profile" src="'. get_the_author_meta('google_plus_icon', $authorID) .'" width="128" height="64" /></a>
<a href="http://www.facebook.com/'. get_the_author_meta('facebook', $authorID) .'" target="_blank"><img alt="Facebook Page" src="'. get_the_author_meta('facebook_icon', $authorID) .'" width="128" height="64" /></a>
<a href="http://twitter.com/'. get_the_author_meta('twitter', $authorID) .'" target="_blank"><img alt="Twitter Page" src="'. get_the_author_meta('twitter_icon', $authorID) .'" width="128" height="64" /></a>
<a href="http://www.linkedin.com/company/'. get_the_author_meta('linkedin', $authorID) .'" target="_blank"><img alt="LinkedIn Profile" src="'. get_the_author_meta('linkedin_icon', $authorID) .'" width="128" height="64" /></a>
</div>
</div>
';
?>
<?php }
}
add_action('thesis_hook_before_content', 'author_info');
Your help is highly appreciated.