Add social icons in a theme through custom admin menu

Is it possible to make a theme with an option of configuring social icons with links through the custom header control panel?

I googled it and found nothing that could help me, any help on that topic will be very appreciated

UPDATE
What I’m trying to achieve is that in the theme control panel (preferably inside the header panel and without using an external plugin) the user will be able to set which social icons will appear and to configure them.

3 Answers
3

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!

Leave a Comment