How To Add Social Media Icons To Your WordPress Website

by · 66 comments

email

Watch this video to see how to add cool looking Twitter, YouTube and Facebook icons that link to your social media profiles to your WordPress Website sidebar.

Note: If you are using the SmallBiz WordPress Theme you can just drag the Social Media Widget to your sidebar and bypass the rest of this tutorial. See this tutorial in the User Guide for more details.

The steps that show adding widgets to your sidebar in this video will work with any Widget-enabled WordPress Theme.

Here is the code

Just copy this code and paste it into a WordPress Text Widget. Then replace the # in the hrefs with links to your social media profiles like I show in the video:

<br>
<p align="center"><a href="#" target="_blank"><img src="./wp-content/themes/smallbiz/images/twitter_link.gif" class="frame" alt="Expand2Web Twitter Feed"/></a></p>

<p align="center"><a href="#" target="_blank"><img src="./wp-content/themes/smallbiz/images/youtube_link.gif" class="frame" alt="Expand2Web YouTube Link"/></a></p>

<p align="center"><a href="#" target="_blank"><img src="./wp-content/themes/smallbiz/images/facebook_link.gif" class="frame" alt="Expand2Web Facebook Link"/></a></p>

<p align="center">I hope you'll join the conversation with us!</p>

A note on the images

Depending on where you have your WordPress installed, the image icons might break when you navigate to sub directories. This is because I can’t predict whether your WordPress install is in the root of your domain or in a sub directory.

But it’s an easy fix though. All you have to do is replace the relative image path:

img src="./wp-content/themes/smallbiz/images/twitter_link.gif

with an absolute one like this:

img src="http://www.localsearchtips.com/smallbizdemo/wp-content/themes/smallbiz/images/twitter_link.gif

Notice how I replaced the . at the beginning of the image path with the complete URL of where your WordPress is installed.

Here are the icons

If you are not using my SmallBiz WordPress Theme then you will need to upload the images to WordPress yourself. I’ve included them below in case you need them. Just right click and Save them to your desktop, then upload to your WordPress media area.




Note: The SmallBiz Theme allows you to set different sidebars per page. This video tutorial shows you how to do that.

Let me know what you think in the comments below – I’d love to hear from you!

If you enjoyed this article, get email updates (it's free).

See my disclosure about advertising and affiliate links

{ 65 comments… read them below or add one }

Berg December 2, 2009 at 12:50 am

Thanks for the code. Appreciate it.

Reply

Don Campbell December 2, 2009 at 1:08 am

@Berg – you bet! Give us a link to your site if you use this so we can check it out!

Reply

Denise January 12, 2010 at 2:49 pm

Thanks for this tutorial–saved me tons of time trying to figure it out!

I’m using smaller icons and would like them to line up horizontally instead of vertically. How do I do that? My site isn’t completed yet, but I included the url so you can see what I’m talking about.
Thanks again!

Reply

Denise January 12, 2010 at 3:58 pm

I figured out how to get the icons horizontal. Thanks!

Reply

Don Campbell January 12, 2010 at 9:02 pm

@Denise , great – I’m glad you got it working!

Reply

Melissa January 30, 2010 at 3:26 pm

Hi Don. Just bought your theme, and I love it! I am still playing around with my site and writing my copy. I have a question about this widget. Do you by chance have a linkedin icon with the appropriate code? Thanks!

Reply

Don Campbell January 30, 2010 at 5:00 pm

@Melissa,
That’s great – thank you!
Good suggestion – I’ve added the LinkedIn icon to the post so you can download it. You can just use the same code as for the other icons but change the image url.
Let me know if you have any trouble getting it to work.
-Don

Reply

Gail Jordan August 9, 2010 at 2:10 pm

Dear Don.

Love your help. Could you be more specific on the Linkedin instructions? Where is the image url?

Thank you Gail

Reply

Stan August 12, 2010 at 1:35 am

Hi Gail

What I did was I copied the code from facebook and deleted the part betweeen the “” that says images and I copied and pasted the image url from the linkedin up above this post. If you right click on the url it gives you the option to copy image url. I hope that helps.

Stan

Reply

Don Campbell August 15, 2010 at 8:30 am

Exactly – thank you Stan!
Gail just emailed me and told me she’s got it now. Here is her site: http://adviceonadvertisingblog.com/

Reply

robert February 24, 2010 at 10:36 am

a little too wide for a two sidebar setup, at least on mine. how can i make this fit?

http://www.thefatandugly.com

Reply

Arian Kelley March 2, 2010 at 6:51 pm

Don,
Thanks so much for the tips! The instructions were fairly
straightforward. Really appreciate the help!

All the Best,

Arian

Reply

Kit Parks March 3, 2010 at 9:27 am

Hi Don,
Watched your YouTube video and it was great. I really appreciate your efforts. I tried pasting the code and I get the links, but only little boxes without the Twitter and Facebook art you show. I’m using Wordpress with the Benevolence theme. Any ideas of what I did wrong? I noticed that after I saved the text that it shortened it. I tried putting in the alternate code, which changed the box to one with a red x to one with an illegible pic. Thanks for any advice!

Reply

Don Campbell March 4, 2010 at 12:27 am

@robert – it looks like you might need to resize the images to make them fit in your sidebar because it is narrow. There is a free image editor called Aviary you can use to resize the social media icons.

@Arian – my pleasure; thanks for the note!

@Kit – It looks like you are using WordPress.com – you will need a place to host the icons so you should upload them to your WordPress media gallery first. For the code, are you adding it to a widget?

Reply

Kit Parks March 4, 2010 at 4:41 pm

Many, many thanks!!! It turns out that it was the template. Once I changed to a wider columned template (Kubrick), problem solved. So not only did I fix the problem with your generous help, I discovered your great website in doing so. Will visit often. Thanks again! Kit

Reply

recipe March 4, 2010 at 11:32 pm

thanks for sharing this valuable information its really helpful for me.

Reply

Susanne March 18, 2010 at 7:29 pm

Don: You made a complication process so easy. Thanks so much! I have a couple of questions, though. Every picture (including the social media icons pics) I have tried to insert on WP won’t show up. It’s just an empty box that is there where the picture should be. This includes whether it’s located in the sidebar or in a post in the middle of the page. What am I doing wrong?

Also, I am wanting to use Flexibility 2 as a theme, but I am struggling to make 2 changes stick. When I go to make the sidebar a dual sub sidebar in the Theme Layout changer, it won’t save, no matter how many times I try to save it. And the same goes for the Theme Lightness Selector. I try to save it to the Lighter setting, but the changes won’t save there either. Which is weird, because all the other changes I have made to my site on the page have “Saved”. How can I fix this?

Thanks very much for your help. It is SOOOOO hard to find someone who knows what they are doing AND who is willing to help AND makes it understandable for a WP newbie dummy like me. You Rock!
-Susanne

http://www.susannegodoy.com (still setting up. Don’t expect much at this point.)

Reply

Susanne March 18, 2010 at 8:06 pm

And to do with the images insertion:

What is the correct size for an image to be and how do I resize it? I know you suggested Aviary, but I looked at it and I don’t have a clue how to work it.

Is there a plugin that resizes images to the correct size? Is there a plugin in existence that lets one put images anywhere on the page, even into a theme header?

Sorry to ask so many questions, but hopefully the answers to these questions will be helpful to others as well.

Reply

Becca April 16, 2010 at 6:30 pm

Thanks for the great tutorial! I’m dying to know about how Denise got her icons horizontal… ??

Reply

jon May 8, 2010 at 6:00 pm

@Becca To make your links horizontal, just make them one paragraph
link link link or you can make them like this with the line separator link | link | link

Cheers!

Reply

jon May 8, 2010 at 6:02 pm

dang, no html code allowed… – p align center – link link link – / p -

Reply

furqon June 24, 2010 at 1:00 am

thanks for the article :)

Reply

Bill Atkinson July 15, 2010 at 12:55 am

Hi Don,
Firstly, thanks for the great info on your site, by far the most informative for a numbat like me..hehe
I have followed your tutorial as per the video and saved the 4 x images into the media library and entered the code into the text widget. The links on the blog do work but the images don’t.
http://billatkinson1.wordpress.com/
How do I fix this please? Thanking you in advance

Reply

Don Campbell July 18, 2010 at 5:09 pm

@Kit, @recipe, @becca, @furqon – thanks!

@jon – thank you for sharing your tips

@Suzanne – How are you inserting the images? Are you doing this in the WordPress post editor, on in the WordPress media gallery? As for resizing the images, you can do that in the WordPress post editor now so you shouldn’t need an external tool to do that any more.

@Bill – Double check your image URLs. In the section of this blog post called “A Note on the Images” it shows you how to make sure your image URLs are “absolute” rather than relative. That will fix the problem you are seeing.

Reply

cosimo August 21, 2010 at 1:13 am

Very useful.
It works !
Thanks

Reply

Esteban Ferreira September 13, 2010 at 5:23 pm

YOU ARE THE MAN!!!!

Thank You

Reply

Glyn October 13, 2010 at 5:05 am

Great tutorial video. I have followed your instructions and the place holders appear in the right place on my website but no images. I have uploaded to Media to Wordpress 3.0.1 and attached them but still nothing. Can you please advise? Thanks

Reply

Lysa Saavedra November 15, 2010 at 3:40 pm

Thanks so much for the code! Here is the link: http://lysa-savvyandsocial.com/?p=1

Lysa Saavedra

Reply

Justin November 18, 2010 at 12:08 am

Hi Don – this was great, I’m an absolute beginner and today was the first time I tried doing something like this. 2 questions if you don’t mind:

My icons take up a bunch of real estate, how can I close the gap between them or may them horizontal? Unlike Denise, I wouldn’t be able to figure this out.

I can’t find the RSS Link widget so people can be automatically updated? I’ve followed the WP help menu and it’s not there.

Thanks again for a great tutorial.
Regards
Justin

Reply

Don Campbell November 23, 2010 at 9:56 am

Hi Justin,
For your icons, it depends on the graphic images but the first thing to try is to adjust the margins. You’ll need to see what styles are affecting your images. Or add a style like: margin-top:0px; margin-bottom:0px; and adjust as necessary.

To find your RSS feed, if you are using WordPress then it is just your blogname/feed. Here’s the full details: Finding your Feed URL.

Reply

Dee Nott November 22, 2010 at 6:58 am

ok..still not understanding exactly how this works I pasted this into the code and was able to get the twitter icon to show up. Are you saying that I just need to change the code for all the others using this same code up to the /facebook_link.gif part of the code.
For instance

Changes to

Reply

Dee Nott November 22, 2010 at 7:04 am

Never mind…LOL I got it now…working just like you said it would…my cut and paste got out of control there!

Reply

Kent Web Designer November 22, 2010 at 5:14 pm

Great resource thanks.
Q: What if you do not have an account with all of the SM sites? Sure you will want to go to the page you have set up for your business but is there a way to go to the Vistors SM account so they can post your url to their profile/account page?
Like when I go to Facebook it goes straight to my profile page. I can add the site myself or post about it.

Do you understand my logic here?

Reply

Don Campbell November 23, 2010 at 10:02 am

Hi Kent Web Designer,
Yes, if you don’t have a social media account, then you can just omit the images for the ones you don’t have. The functionality you are talking about is more like a “Like” button or “Share” button that you can add – like I add to my posts. That way if the user Likes it they can share it on their Facebook activity stream. I’ve got a post showing how to set that up here: Pimp Your Blog with Facebook Social Plugins.

Reply

TheStephConcept December 1, 2010 at 10:42 pm

Thank you so very much!! Took me alll day, but when I figured it out, I felt like I could do back flips!! Thnx a million!

Reply

Blaine Fallis December 4, 2010 at 12:12 pm

Exactly what I was looking for. Thanks!

Reply

George January 5, 2011 at 7:35 pm

Is there a Linked In icon that can be used? I saw it on another of your clients sites in the portfolio. Thank

Reply

Don Campbell January 5, 2011 at 8:12 pm

George,
The Linkedin icon is in this blog post above. Just right click on it to save it and upload it to your site. This video shows you how to upload your own image into WordPress: Add an Image to WordPress.

Reply

George Page January 6, 2011 at 7:57 am

Excellent, thanks!

Reply

Blaine Fallis January 9, 2011 at 2:15 am

Just a mention that for me I needed to change the code from ./wp-content to ../wp-content and then the images appeared in my sidebar using this code. My wp install is in the root. Thanks.

Reply

Roger January 22, 2011 at 3:50 pm

Hey Don,
Am I correct in assuming I cannot have both an opt in box and the social media widget beneath it on the sidebar. I’ve been playing with it for a while, tried every which way but loose:) to no avail. I come up with one or the other but not both. Thanks

Reply

Don Campbell January 22, 2011 at 7:29 pm

Hi Roger,
You can have as many widgets as you want in the sidebar. I think what is happening, is that the default social media icons you see in the sidebar are just an example. When you add a new widget, they disappear. You’ll want to add your own, with links to your social media sites.

In the latest version of SmallBiz, you’ll see a widget that you can just drag over and you’re done. If you are not using the latest version, or are using a different theme, you can follow the instructions in this post above to create your own customized widget.

Reply

cece March 16, 2011 at 8:29 am

Hey I’m a newbie just stop by to learn from those who are doing it. I will implement these into my blog thanks a lot.

Reply

Mark March 20, 2011 at 6:49 pm

Very nice explanation on how to do this! You saved me a lot of time and frustration. I’ll be checking out the rest of your siteThanks Don!

Reply

Arno April 10, 2011 at 1:14 pm

Dude, your the man! I don’t know anything about programming or code, but I got it all to work just dandy! thanks!

Reply

Eric April 21, 2011 at 2:50 pm

Hey Don,

I am currently putting together my wordpress site and I am trying to figure out how to place the social media icons horizontally in the sidebar. I saw another person explain that, but I really couldn’t make sense of it since I am so new to this stuff. Any help would be greatly appreciated. Thanks!

-Eric

Reply

Facebook Icons May 5, 2011 at 6:43 am

Nice guide man. Remember guys, you’ll increase the CTR (click through rate) on your social media icons if you select an appropriate color / size that best fits your website.

Reply

Irfan July 13, 2011 at 12:14 pm

Hey,

It was nice to have a video tutorial on my topic.

Thanks

Reply

Clearpores August 23, 2011 at 6:26 am

How can I add social media buttons slidebar to my webpage?

Reply

Ecig Addict August 24, 2011 at 7:16 am

Just wanted to say hi and thanks for the guide and the widget icons!

Mech

Reply

Sylviane Nuccio August 30, 2011 at 7:31 am

Thanks Don, That’s a great resource to learn how to add those useful buttons on your blog.

Reply

Rak Design September 9, 2011 at 2:26 am

Great tips! Thanks :)

Reply

Marsha Locke September 17, 2011 at 4:51 pm

Had problems to start with. I added the Text widget but no images appeared in the side bar.
So I saved the images to my media in wp. Then copied and pasted the file url from the media and it worked!!! I cant tell you how pleased I am >:O)
Thank you very much, great advice.
Keep up the great work.

Reply

brycetil September 19, 2011 at 7:22 pm

Hi,

great work, thanks so much. this is great and i will certainly recommend your theme in the future.

how did you make the images or wwere did you get them from? i am trying to have similar icons for my seekingalpha.com profile as well as fool.com profiles. and even a skype profile? how could i get these images the same as the facebook twitter etc. willing to pay a small fee! thanks so much

Reply

Jerry Kaufman September 19, 2011 at 9:53 pm

Hi, Thank you very much for the instructional video to put Facebook on my webpage. Everything seems to do well and I even put in the alternate line for the Facebook icon since I am not using your program but am using WordPress.

And I put the Facebook icon of yours on my desktop and I, of course, have completed the widget with the alternate line you suggested.

Now I try to download the Facebook icon from the desktop to the Media and get the message “error saving media attachment.”

Would you please send me list of possible errors I am making?

Jerry

Reply

GraceArreza Katre September 22, 2011 at 1:58 am

I followed your instructions and it worked!! Thanks a lot..

Reply

Leave a Comment

{ 1 trackback }

Previous post:

Next post: