I did something similar on my site a while back. I’m sure you can tweak it to fit your needs.
Under each article I have an author box with social media icons that link to their accounts.
In content-single.php
<?php if ( get_the_author_meta('twitter') ) : ?>
<a href="http://www.twitter.com/<?php the_author_meta('twitter'); ?>" title="Twitter"><img src="<?php bloginfo( 'url' ) ?>/images/twitter.png" /></a>
<?php endif; ?>
<?php if ( get_the_author_meta('facebook') ) : ?>
<a href="http://www.facebook.com/<?php the_author_meta('facebook'); ?>" title="Facebook"><img src="<?php bloginfo( 'url' ) ?>/images/facebook.png" /></a>
<?php endif; ?>
<?php if ( get_the_author_meta('gplus') ) : ?>
<a href="http://plus.google.com/<?php the_author_meta('gplus'); ?>" title="Google Plus"><img src="<?php bloginfo( 'url' ) ?>/images/google.png" /></a>
<?php endif; ?>
<?php if ( get_the_author_meta('linkedin') ) : ?>
<a href="http://www.linkedin.com/in/<?php the_author_meta('linkedin'); ?>" title="Linkedin"><img src="<?php bloginfo( 'url' ) ?>/images/linkedin.png" /></a>
<?php endif; ?>
In functions.php
function social_media_icons( $contactmethods ) {
// Add social media
$contactmethods['twitter'] = 'Twitter';
$contactmethods['facebook'] = 'Facebook';
$contactmethods['gplus'] = 'Google Plus';
$contactmethods['linkedin'] = 'Linkedin';
return $contactmethods;
}
add_filter('user_contactmethods','social_media_icons',10,1);
This adds extra fields in your user profile settings (wp-admin/profile.php or wp-admin/user-edit.php?user_id=1). When you fill them out the social media icons appear. If the fields are left blank, nothing gets displayed.
Hope this helps!