How To Add Killer Social Icons With Thesis

by Matt on August 11, 2009

IE7 and IE8 display issue is fixed!

Changed the background position from “-3.2em” to “32px.” Changed width from “3.2em” to “32px.” Simply make those changes and it should work great! Thanks to gtalbot.org, who listed it as number 37 of 171 allegedly fixed bugs in IE 8 [fixed as of 6001.18343]. Sorry I didn’t notice this sooner, guys!

Social Icons Code Update: 8/14/2009

The code for this tutorial has been updated in the text, with a new video coming momentarily. Please make sure that you make the proper adjustments. This now validates like a mofo ;)

Share Yourself In Under Seven Minutes

So, as I sit here and get severely tortured by my wife’s new obsession called “More To Love”, I figured I should share a really awesome way to display some social networking icons, RSS and email just like you see to the left on my site. In less than 7 minutes you will be able to connect your readers/users/subscribers to your Twitter, Facebook, RSS and Email all using Thesis Hooks. Below is the code you need to make it all happen.

Put This In Your Custom_Functions.PHP

function social_iconz() {
?>
<div id="feedback"><a href="http://twitter.com/yourusername" id="twitter">[your name] on Twitter</a><a href="http://facebook.com/yourusername" id="facebook">[your name] on Facebook</a><a href="Your RSS Feed URL" id="rss">[your] RSS Feed</a><a href="mailto:youraddress@whatever.com" id="email">[your] Email</a></div>
<?php
}
add_action('thesis_hook_after_html','social_iconz');

Put This In Your Custom.CSS

.custom #feedback { background: transparent; width: 3.2em; position: fixed; top: 40%; left: 0.25%; }

.custom #feedback a { display: block; text-indent: -9999px; height: 32px; outline: none; }

.custom #feedback #twitter { background: url('http://thesistutor.com/wp-content/uploads/2009/07/twittericon.png') no-repeat 0 -32px; }
	.custom #feedback #twitter:hover { background-position: 0 0; }

.custom #feedback #facebook { background: url('http://thesistutor.com/wp-content/uploads/2009/07/facebookicon.png') no-repeat 0 -32px; }
	.custom #feedback #facebook:hover { background-position: 0 0; }

.custom #feedback #rss { background: url('http://thesistutor.com/wp-content/uploads/2009/07/rssicon.png') no-repeat 0 -32px; }
	.custom #feedback #rss:hover { background-position: 0 0; }

.custom #feedback #email { background: url('http://thesistutor.com/wp-content/uploads/2009/07/emailicon.png') no-repeat 0 -32px; }
	.custom #feedback #email:hover { background-position: 0 0; }

Special Cases

Special cases will be updated as I discover them. Special cases can, from time to time, cause HTML validation errors. The errors are NOT a product of my work, but are issues with the way that sites such as Delicious and StumbleUpon work their magic. If you have a validation concern, please email me.

For Delicious, the CSS principle stays the same but what goes into custom_functions changes.

<a href="http://delicious.com/save" onclick="window.open('http://delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=550,height=550'); return false;" id="delicious">Bookmark this</a>

For StumbleUpon, the CSS principle stays the same but the custom_functions changes.

<a href="http://www.stumbleupon.com/submit?url=<?php the_permalink(); ?>&title=<?php the_title(); ?>" id="stumbleupon" target="_blank">Stumble</a>

AND DON’T FORGET!
You are WELCOME to use the images I have made for YOU! In fact, if you want me to make others, I will!

Here are the ones I can make:

  • AIM
  • Apple
  • Bebo
  • Blogger
  • BrightKite
  • Delicious http://thesistutor.com/wp-content/uploads/2009/07/deliciousicon.png
  • DesignFloat
  • Digg http://thesistutor.com/wp-content/uploads/2009/07/diggicon.png
  • Dopplr
  • Flickr http://thesistutor.com/wp-content/uploads/2009/07/flickricon.png
  • FriendFeed http://thesistutor.com/wp-content/uploads/2009/08/friendfeedicon.png
  • Gamespot
  • Google
  • GoogleTalk
  • Last.fm
  • LinkedIn http://thesistutor.com/wp-content/uploads/2009/07/linkedinicon.png
  • Mixx
  • MobileMe
  • MySpace http://thesistutor.com/wp-content/uploads/2009/07/myspaceicon.png
  • NetVibes
  • NewsVine
  • OpneID
  • Picasa
  • Plurk
  • Posterous http://thesistutor.com/wp-content/uploads/2009/07/posterousicon.png
  • Reddit
  • Skype
  • StumbleUpon http://thesistutor.com/wp-content/uploads/2009/07/stumbleuponicon.png
  • Technorati
  • Tumblr
  • Viddler http://thesistutor.com/wp-content/uploads/2009/07/viddlericon.png
  • Vimeo http://thesistutor.com/wp-content/uploads/2009/07/vimeoicon.png
  • Virb
  • Windows (though I won’t be happy)
  • WordPress
  • Yahoo
  • YahooBuzz
  • Yelp http://thesistutor.com/wp-content/uploads/2009/07/yelpicon.png
  • Youtube http://thesistutor.com/wp-content/uploads/2009/07/youtubeicon.png

How To Get Your Icon

In order for me to make an icon you may either leave me a comment on this post or send me an email by clicking the little mail image to the left of the screen.

Don’t Forget To Pick Up Your Copy Of Thesis!

Also, help keep Thesis Tutor alive by donating!

{ 6 trackbacks }

{ 177 comments… read them below or add one }

Beth Hood February 25, 2010 at 11:23 am

Thank you so much for all of your tutorials, and especially for this one. I had it up in closer to 3 minutes! I really appreciate your easy-to-follow instructions and your giving nature. I will return again and again to your site. Although I think I’ve already implemented almost all of your suggestions already, so can’t wait for new ones…
Aloha, Beth

Reply

George E. Kennedy, Jr. February 28, 2010 at 5:18 pm

Thanks Matt. A few things have me puzzle. When I add my own icons and url nothing shows up. When I leave your url icons show up. Sometimes half of my icons show up. They are 50px

Reply

Matt February 28, 2010 at 11:04 pm

@George
The right image size or an adjustment is CSS is required.

Reply

Avinash D March 6, 2010 at 3:56 pm

Hi Matt,

Awesome code!!Would you be willing to provide the icons so a user can store them on their server? Also, I personally find the spacing a bit tight. Assuming, the icons are 20×20(hypothetically) each for a full space of 80 px, how do I get a spacing of 20px after each icon for a full space of 80px+20+20+20=140px.

It’s not a css spacing issue cos I’ve tried that…the rollovers don’t…roll. :-)

Reply

Matt March 6, 2010 at 4:40 pm

@Avinash
Actually, it is 100% CSS. Just add margin-bottom: 20px; to each icon id (i.e. #twitter) that you want space after. That’s it.

As far as the images, just type in their address on my server (I give them in the tutorial), right click, copy paste in an image editor. If you don’t have Photoshop, pick up GIMP. It’s free.

Reply

Rachael Gollub March 25, 2010 at 1:27 am

Hi,

My site is still in the dev stages. I can’t seem to get this simple addition to work, despite your very clear and helpful tutorial. I am starting to think that I may have bigger problems, as I have run into other issues with customizations. Please let me know if you have any recommendations.

Thanks!

Reply

Matt March 25, 2010 at 5:10 pm

@Rachael
99 times out of 100 problems are caused by simple errors like absence of a period, an extra space, etc. If you send me a link I can take a look. Otherwise there isn’t much I can do.

Reply

Rachael March 25, 2010 at 11:22 pm
Matt March 28, 2010 at 1:38 pm

@rachael
I’m not seeing your site, but I remember looking at it and I never saw any of the code in the markup. I encourage you to try again.

Rachael March 27, 2010 at 8:04 pm

Could have sworn I already replied to this…

That would be great if you could take a quick look. here is the link: http://www.tribalrendezvous.org/blog/wordpress

Reply

Camelle April 17, 2010 at 1:43 am

Love it, great code thanks.

Is there anyway Twitter, FB and RSS can open in a separate webpage or tab? I want the social networking but don’t want to divert traffic away from my site.

Thanks.

Reply

Matt April 19, 2010 at 9:54 pm

simply add target="_blank" to the <a href="...."> tag.

Reply

Cherie April 21, 2010 at 12:14 pm

Hi Matt,
Is there a way to get these horizontal at the top of the page instead of vertical on the left?

Reply

Caleb Gardner April 24, 2010 at 12:29 pm

Hey Matt,

Could we get a Tumblr icon? Thanks!

Reply

Wojtke April 27, 2010 at 10:00 am

Great tutorial – makes sense, but, how do I adjust CSS to accommodate larger image?

Thanks

Reply

Matt April 27, 2010 at 12:27 pm

Just adjust the width in .custom #feedback and the height in .custom #feedback a.

Reply

Sriraj April 28, 2010 at 2:34 am

Can I have the icon for Google’s Orkut? I found the icon on the Google web elements page but that mini button was too small to fit in between twitter and FB.
Actually I’m changing each image href to share the individual post, not just the whole blog. I did it for FB but for twitter it isn’t working.
I used
http://twitter.com/home?status=Reading: without much success. Even if it does work, it won’t be of much use as the permalink itself will be huge for twitters 140 charec limit. WP has a default URL shortener like wp.me/abcdef, but I couldn’t find any template tag for it in the codex.
Any help in this regard will be greatly appreciated Matt..
PS. I’m doing all this on a local test site.

Reply

Sriraj April 28, 2010 at 2:37 am

Oops, that twitter href that I tried appears cut after submitting the comment.
That link is followed by the ‘the title’ and ‘post permalink’ template tags.

Reply

Jim May 6, 2010 at 4:59 am

Any idea why I might be getting this error after copying and pasting your code into my custom_functions.php file;

Parse error: syntax error, unexpected ‘}’ in /home/xxxxxxx/public_html/wp-content/themes/thesis_17/custom/custom_functions.php on line 287

Thanks

Reply

Matt May 8, 2010 at 6:51 pm

Perhaps you are missing a ‘;’ Go through your code and check for typos. Hope that helps!

Reply

Jim May 9, 2010 at 1:35 am

Everything is fine until I paste your code (exactly as it is written) into my custom_functions.php file, I just can’t figure it out. :/

Reply

Jim May 9, 2010 at 2:15 am

It appears that there should be a space after the comma – (‘,’social_iconz’); ). Adding that space fixed my problem anyway.

Reply

Tave May 12, 2010 at 7:29 am

Matt,
Thank you so much for the tutorial. By far the easiest I’ve come upon. I am relatively new to the Thesis theme but thus far I love it. I wanted to know if you could make a wordpress icon? I was hoping you had already made one but just forgot to place it with the others you mention above. When I attempted to add the code you provided, everything worked correctly (space was made for the icon and when clicked it would take me to the desired wordpress.com blog) but there was no image (icon) in the space. Could you possibly make a wordpress icon for us?

Thanks a lot. Please check out my site and see what I’ve done thanks to your tutorial.

Reply

Will May 16, 2010 at 2:02 pm

I have been using this and while it works well with most displays, I have recently been told that on some resolutions and also on small netbook computers, the icons are on top of the content area, blocking the content. Any ideas why this might be happening? Thanks!

Reply

Matt May 20, 2010 at 8:41 am

Not sure about that. Probably due to the fact that the icons are positioned absolutely. I can easily imagine small displays and low resolutions having issues ;) Hope that helps.

Reply

Will May 20, 2010 at 8:35 pm

Yeah I decided to go with icons within the single posts and can these. I like this setup better, but with the proliferation of small displays and netbooks, I was getting to many complaints.

Reply

Maxine Stephenson May 17, 2010 at 8:35 am

Matt, your video tutorial seems so clear and precise, and yet I managed to mess up my site.
I have this error message.
Parse error: syntax error, unexpected ‘}’ in /home2/maxinesa/public_html/maxinestephenson/wp-content/themes/thesis_17/custom/custom_functions.php on line 8

I copied the code for the php part of it to notepad, and then double-checked it with your video, changing things to match the video instructions, and yet I can’t get it to work. Can you imagine what might be wrong?

This is the code that I put in

function social_iconz() {
?>

<?php
}
add_action('thesis_hook_after_html','social_iconz');

Please help!

Reply

Maxine May 17, 2010 at 8:56 am

EWWwwww I did don’t know why the code didn’t copy in my earlier comment.
I DID find a couple of things missed out, can you believe it? I fixed them up and tried again,but still get the same error. Now it seems I can’t access my site.
The following is the code i ended up with, but still doesn’t work for me:

function social_iconz() {
?>

<?php
}
add_action('thesis_hook_after_html','social_iconz');

Reply

Maxine May 17, 2010 at 8:58 am

There must be a reason I don’t know about, why the code doesn’t copy in the comments. I seem to be a complete dummie at this……..

Reply

Matt May 20, 2010 at 8:50 am

Yeah, code isn’t copy and paste. You have to use html codes like &lt; for <.

Anyway, I'm not sure where your particular issue is. I copy/pasted the code onto my test site without issues. Try copy/paste without changing anything and see if that works.

Reply

Cyril May 18, 2010 at 9:24 am

Hi Matt,

Thank you very much for your tremendeous job.
Regarding this tuto, I’ve respected all steps, but it doesn’t work.
Let me know if you can help me
Best regards
Cyril
from France

Reply

Matt May 20, 2010 at 8:52 am

You will have to describe the issue more for me to help ;) Are you getting parse errors? Are they just not showing up?

Reply

XGG May 22, 2010 at 4:25 pm

Thanks!!!
Can I get the Tumblr icon from you?

Thank you for sharing!

Reply

Mitchell Jamel May 24, 2010 at 12:14 am

Matt, thanks for creating this and making it simple. Please send me the Icons

Mitchell

Reply

Jeb May 26, 2010 at 3:35 pm

Hi Matt,
Coming back to this tut for the 2nd time (couldn’t make it work the 1st time) and I’ve ALMOST got it handled. The only problem I’m having is the icons are invisible UNLESS you hover over them. Then they show up and the images are good and the links all work properly, but if the mouse isn’t on it, you can’t see it.

Any idea what I’m doing wrong?

Thanks bud…Jeb

Reply

adacosta June 1, 2010 at 2:00 pm

great vid/article. well done.. nice and concise.

AD

Reply

Keith Jones June 7, 2010 at 12:58 pm

Matt

Thanks for the code, I have used it on my website – I have given you a link back from my site.

I was going to do this from scratch but could not figure out which hook to use until I saw your video.

However I can not figure out how the images change – I have it working fine – but can you explain how they change?

Keith

Reply

Lazar June 22, 2010 at 12:05 pm

Hey Matt!

Is there a chance for Reddit icon?

Thanks a lot for your tutorial!

Reply

Mike July 29, 2010 at 12:08 pm

Great work Matt. Although I still have to tweak it a little, I’ve used it on my site and it works great. Thank you for this excellent addition.

Reply

Joel August 5, 2010 at 3:48 pm

I did everything according to the instruction and the icons are on the bottom of the page, how can I fix this…here is the link: http://mileycyrusmyfansite.com/

Reply

Joel August 5, 2010 at 3:53 pm

Nvm, I got the fix…I missed the ‘.’ before one of the custom

Reply

David August 11, 2010 at 1:23 pm

Great work Matt! I love these icons but like the unanswered commenter above me, is there any way to get these going horizontal in CSS?

Reply

Katrina August 13, 2010 at 5:30 pm

so simple, so straight forward and worked perfectly immediately – thank you, thank you, thank you!

Reply

Robert Macadaeg August 17, 2010 at 8:57 am

Thanks Matt!

Reply

Shant August 21, 2010 at 2:02 am

Hey Matt..

Im new to thesis and love your site… I watched your video on adding social networking icons.. awesome! I noticed you said that we can use the buttons you had made… I dont want to sound ignorant but where can I get those icons images.

Thanks for your work … will donate when I have some extra cash.

Shant

Reply

Richard August 22, 2010 at 11:52 am

It works but I cannot see the icons unless I hover over them.

I have checked it on Safari and IE8.

I would love to find the solution as this is a killer app!

Reply

Richard August 22, 2010 at 12:35 pm

The problem was solved when I used youyr icons instead of mine.

Any idea why this would occur?

Can I download yours and upload them?

I need an icon for tumblr.

Thanks.

Reply

Melissa August 22, 2010 at 3:02 pm

I’m having the same issue where my icons arent showing up unless the mouse is hovering. I wanted black and white icons that were a little larger so I adjusted the height to 55px and now theyre invisible. Any way to fix this?

Reply

Leave a Comment

Previous post:

Next post: