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!

{ 8 trackbacks }

{ 198 comments… read them below or add one }

Matt Langford August 11, 2009 at 10:29 pm

Great tutorial, Matt! I think I had good timing in telling people to follow you on Twitter!

I would like a Friendfeed icon when you get the time. Thanks a lot! Looking forward to more screencasts!

Reply

Matt August 12, 2009 at 12:04 am
kristarella August 11, 2009 at 11:47 pm

Nice one. I had a bunch of people ask me about this sort of thing when I had something similar on my site. Now I can point them to this!

Out of curiosity, does it work in IE if you tell it to sit on the right instead of left? I don’t think mine did.

Reply

Matt August 11, 2009 at 11:54 pm

Not sure. I’ll find out.

Reply

Fabi August 12, 2009 at 4:58 pm

Matt, thank you so much for these tutorials!

Fabi

Reply

Ashwin August 13, 2009 at 1:33 am

Hi Matt,

A very cool tutorial. Thanks for sharing. I am planning to try this out over the weekend.
Also the icons are very cool.

Regards,
Ashwin

Reply

Matt August 13, 2009 at 2:06 am

Thanks! Let me know if I can make any icons on the list for you.

Reply

Ashwin August 13, 2009 at 4:55 am

Thanks for asking! I think the icons you already provided should do good and I also used the FF icon you created for Matt.
Subscribing to your site and looking forward to interesting Thesis tutorials!!

Reply

James Thomason August 14, 2009 at 4:24 am

This is pretty awesome!
I am not good at editing websites but your website helps a lot!

As for icons…
I wouldn’t mind seeing a
Digg icon
YouTube icon
Delicious
MySpace
and StumbleUpon

Sorry for being icon hungry.
Take your time. No need to rush

Thanks a lot!

Reply

Matt August 14, 2009 at 7:05 pm
James Thomason August 14, 2009 at 8:03 pm

Thanks a bunch Matt!

Reply

Eric Roberts August 14, 2009 at 9:30 pm

I don’t use Thesis, so I can’t comment on the usability of this recommendation. However I have two (important, IMO) recommendations to make this add-on better.

1) The HTML you’re using is invalid. You’re placing a block element (div) inside an inline element (anchor). Based on the way your CSS is set up, you shouldn’t need the DIV element at all. Simply add the ID’s to the anchor elements.

2) Internet Explorer 6 does not support the :hover function for elements other than anchors. In order to keep some usability for IE6 users (if you want to, and I highly recommend it for a general release like this), you should make sure the anchor tag is in the CSS. Using the added ID to the anchor, the CSS can now read: .custom #feedback a#facebook:hover {}.

I’d also avoid using EMs for the specific image sizes, since EMs are relative and can inherit sizes other than what you might intend.

Please let me know if you have any questions. And thanks for sharing this tutorial to the web community :)

Reply

Matt August 14, 2009 at 10:49 pm

Eric-
I blame it all on beer. Made the appropriate changes and all is well. Thanks for pointing that out!

Reply

Miraz Jordan August 14, 2009 at 9:46 pm

This is an interesting technique, and I like the way it looks on your site, but I’m concerned about what it may do to the validity of our pages.

When I drop the code you supply into an otherwise blank XHTML (strict or transitional) document and validate, it warns that a div may not be contained within an a element. That stands to reason as the spec says:

“Generally, block-level elements may contain inline elements and other block-level elements. Generally, inline elements may contain only data and other inline elements.”

Does it still work if you put the link inside the div, rather than the other way round?

Reply

Matt August 14, 2009 at 10:48 pm
Matt August 14, 2009 at 10:21 pm

A few concerns about HTML validity have surfaced. I will have an update very soon. Though the technique will remain essentially the same, there will be a couple of changes.
-Matt-

Reply

Eric Roberts August 14, 2009 at 11:45 pm

@Matt: Beer has a way of doing stuff like that to our code, doesn’t it? :) Glad to see you’re following up on comments and improving the code.

Your CSS can be improved upon even further, if you’re interested. Shoot me an email, I don’t want to clutter up comments with stuff like that (don’t want to confuse users too much over what code they should use).

Reply

Harsh Agrawal August 15, 2009 at 3:51 am

Hey Matt Thanks a lot for this wonderful tutorial and it is very helpful…
I have just added these beautiful social icons, though now I’m using your links for images, but will upload it in a while…
Meanwhile Matt from mattfiles given me this link and I’m so glad to be here :)
keep up the Good work..

Reply

Kevin August 15, 2009 at 6:38 am

Matt,

First, let me thank you for your videos as they are incredibly helpful. Unfortunately, somehow I managed to screw this little project up. I downloaded a set of icons and tried just to install the Twitter button. I uploaded it to my images folder and used the following code in CSS:

.custom #feedback #twitter { background: url(‘http://cwmemory.com/wp-content/uploads/2009/08/twittericon.png‘) no-repeat 0 -3.2em; }
.custom #feedback #twitter:hover { background-position: 0 0; }

Can you tell if I am doing anything wrong. I am more than happy to provide more info. if necessary.

Thanks

Reply

Max August 15, 2009 at 10:56 am

Hi,

Really love your social icons and the tutorial. Great job.

If I want to use your Delicious icon and have them ‘bookmark’ the page they’re reading in Delicious and have it pop up in a new window (so readers don’t stray away from my site), what would the code for that be?

The same type of code would apply for StumbleUpon I suppose?

Cheers,
Max

Reply

Matt August 15, 2009 at 11:05 am

@Kevin
If you copy and paste exactly what I have you shouldn’t have any issues. I just tried it on a test site of mine and it was fine.

@Max
I’ll check in to that and update accordingly.

Reply

Max August 16, 2009 at 3:23 am

Cool, thanks a lot. Looking forward to it.

And if you could throw in a Viddler icon as well while you’re at it, that would be superb!

Cheers,
Max

Reply

Matt August 16, 2009 at 12:14 pm
Kevin August 16, 2009 at 9:22 am

For some reason I thought I needed to put my own url into css. I’ve pretty much figured it out.

Thanks

Reply

Max August 16, 2009 at 2:23 pm

Impressive Matt, thanks a lot!

Did you also have a chance to look into that Delicious/StumbleUpon code request I mentioned earlier? If not, no hurry of course. I’ll keep on checking your great site on a daily basis.

Cheers,
Max

Reply

Matt August 16, 2009 at 4:57 pm

@Max
Yeah, man. I posted it yesterday under “special cases.” Look above in the article.

Reply

Lon August 16, 2009 at 6:44 pm

nice work, any chance you can make one for shelfari?

Reply

Matt August 16, 2009 at 11:13 pm

@Lon
I’m limiting the icons to the ones on the above list. If you find one or make one I will gladly put it up!

Reply

Lisa Vickery August 16, 2009 at 9:26 pm

Matt,
Thank you for the great work you do. You are such a good teacher!

Reply

Lon August 17, 2009 at 11:49 am

hrm, oddly putting it in thesis_hook_before_html makes everything else on the page drop below for me…

Reply

Matt August 17, 2009 at 1:59 pm

@Lon
It shouldn’t, but you can put it in thesis_hook_after_html, too.

Reply

PJ Mullen August 17, 2009 at 4:30 pm

Matt,

This is awesome. Love your site. I’m a noob, so I’m just figuring all of this stuff out. I just put this on my site and it rocks. The only issue I’m having is the Twitter button doesn’t stay. It shows up when I first pull up my site, then it goes away and looks like a text link. Any ideas?

Thanks!

pj

Reply

Lon August 17, 2009 at 4:55 pm

I tried that, for some reason everything floats to the top left. can’t figure out it out for the life of me…

Reply

Max August 18, 2009 at 5:24 am

Sorry Matt, didn’t catch the special classes insert the first time around. Thanks a lot for the great work!

Cheers,
Max

Reply

Matt August 18, 2009 at 7:37 am

Hey Matt,

Awesome tutorial and icons. Could you do a Flickr one by any chance?

Reply

Matt August 18, 2009 at 5:37 pm

@PJ
Went to your site and I don’t see any problems. Not sure what you’re seeing.

@Matt
http://thesistutor.com/wp-content/uploads/2009/07/flickricon.png

Reply

Lon August 18, 2009 at 11:44 pm

finally got it working , had an extra } hanging around somewhere screwing everything up. Thanks!

Reply

Su Butcher August 19, 2009 at 6:51 am

Hi Matt,
Thanks so much for sharing this after my query over on Matt Flies.
Seems to have gone off without a hitch – nearly ready to launch the blog now, I’m so excited! Havent done any coding since about 1990 so this is my first ever foray into such new stuff and your guides are very helpful.

I wondered if you’ve ever done a Feedburner icon, as I’ve got one on another part of the site for people to click to sign up for feedburner email updates from the site as an alternative to RSS. Some of our audience (who will see the blog as a website) won’t be RSS users, and it might make a useful addition to your ‘email us’ button.

Have already told stacks of people about your site and sure some of my blogging friends will pop over here when they see your cool buttons!

Reply

Lisa (strongmothers.com) August 19, 2009 at 7:48 pm

Hi Matt,

I followed the steps and it worked on Safari, but not on internet explorer. Is this unusual?
Thanks again,
Lisa

Reply

BeingAKB August 19, 2009 at 8:37 pm

Great tutorial. I’m switching my blog over to the thesis theme this weekend and will try this out!

Reply

Anshoo August 22, 2009 at 11:53 pm

Thanks Matt. This is an amazing piece of work – so simple to implement and so elegant.

Kudos to Matt Langford for referring me to ThesisTutor.

Reply

Anshoo August 23, 2009 at 12:01 am

Matt, if you have some time, could you please make a LinkedIn icon as well? I’m sure it will be of use to myself and many others. Thanks!

Reply

McLaughlin August 25, 2009 at 8:16 am

Thanks, I’ve done this on a couple of sites that I support and look forward to the feedback when then see it.

one tip to anyone using this, writing a URL as http://http://domain does NOT work. Something about using http twice. Go figger.

Reply

Tushar August 27, 2009 at 3:02 am

Hey, Matt.

How can I use this in other themes apart from Thesis? Please advice.

Reply

Matt August 27, 2009 at 12:05 pm

@McLaughlin
I’m not sure what your “tip” is in reference to. “http://http://domain.com” isn’t anywhere on this page or in the video. Would you mind to explain?

@Tushar
I only work with Thesis on this site. You are welcome to hire me to consult on your project, however.

Reply

David Ballard September 1, 2009 at 7:09 am

Hey Matt,
Thanks so much for this! I’m using it right now and it’s working well. Any plans for a Vimeo icon?

Thanks,
David

Reply

Matt September 2, 2009 at 11:56 am

@David
Sorry it took so long to get back to you.

http://thesistutor.com/wp-content/uploads/2009/07/vimeoicon.png

Reply

Terry Bean September 3, 2009 at 8:00 pm

Hi Matt, fascinating tips.

Would you consider Spoke and LinkedIn, too? :)

Thanks- T

Reply

Tammy from RowdyKittens September 4, 2009 at 9:55 am

Thanks Matt! This was so helpful! I’m working on cleaning up my site and getting ride of my sidebar widgets. So this is awesome. :)

Matt (from Matt Flies) sent me over to your site. I’m going to add it to my reader. Thanks again.

Reply

Damaris September 11, 2009 at 3:03 pm

Hi Matt,
I really love your tutorials – it is great for such css-illiterate people like me :-) I was just wondering if I could manage to have the icons in a horizontal row instead of a vertical one. Any hint?
Thanks a lot,
Damaris

Reply

Mary Ann September 12, 2009 at 12:47 pm

My twitter icon doesn’t show up unless you hover over it. I was trying to use a different set of icons because I also want to add linkedin.

I copied your code and just substituted my icon url.

Reply

Avi September 14, 2009 at 8:32 am

This is amazing!!!It’s exactly what I wanted!!!

Reply

Matt September 14, 2009 at 3:04 pm

@Terry
Linked In: http://thesistutor.com/wp-content/uploads/2009/07/linkedinicon.png
I am only able to do icons on the list above.

@Damaris
Working on that.

Reply

Matt September 14, 2009 at 3:08 pm

@Mary Ann
That linkedin icon is for you, too

Reply

Su Butcher September 15, 2009 at 3:26 pm

Hi Matt,
Love your social icons so much, have used them on the reworking of my site (with a credit of course!)
Hope it gets you some traffic. Someone’s asked me about them already and the sites only been up since the weekend.
Best,
Su Butcher

Reply

Dhane September 22, 2009 at 4:11 pm

I’ve been looking for a tutorial like this for ages. Thanks!!!

Reply

Ravi September 23, 2009 at 11:53 pm

Thanks for these tutorial videos. They are helping me a lot in learning thesis.

I have used the code in this article but icons don’t seem to appear properly in IE. I tried IE6, 7 and 8. However, in Chrome they appear correctly. Any idea what is wrong with IE?

Reply

Damaris September 28, 2009 at 12:12 pm

The icons are quite a success on our new website. Thanks a lot, Matt! :-) Any idea about putting them horizontal, yet?

Reply

Robert Palm September 29, 2009 at 6:11 pm

I’m just learning Thesis (and css/php/html for that matter) and absolutely love your tutorials.

Please hook me up with a Yelp icon I can add to the ones you already shared.

Thanks!

Reply

Matt October 4, 2009 at 8:43 am

@Ravi
The problem is with IE. It simply doesn’t recognize backgrounds on a tags. I am actually working on a javascript version of the icons that will fix it. I may do some custom IE code, but I’m not sure. I will certainly do a tutorial on how to make a javascript pop-up that displays for IE users that recommends they get Firefox :)

@Damaris
This javascript version I’m working on will take care of that. If you have an application that needs them horizontal right now, email me and we can work it out.

@Robert Palm
http://thesistutor.com/wp-content/uploads/2009/07/yelpicon.png

So sorry it took me this long to help you guys. In the future I will cut the delay down significantly. Thanks again for supporting my site.

Reply

Chris October 5, 2009 at 4:48 am

Matt,

I can’t seem to get the icons to show up in Internet Explorer, is there any reason for this or is it just down to IE being pants?

Reply

Matt October 5, 2009 at 10:29 am

@Chris
Yeah dude. IE sucks. I’m working on a new social icons tutorial that is javascript based. Hopefully I will fix the IE problem there. To be honest, I really don’t work with IE because it is losing market share and is generally a poor browser. I can’t stand the way it interprets simple code.

Reply

Rachael October 8, 2009 at 2:15 pm

Hi there-

Just wondering if you ever got the icons to work in IE.
A lot of my clients use IE….unfortunately….

I personally love the icons! Thank you!
Rachael

Reply

Matt October 12, 2009 at 2:29 pm

@Caleb
http://thesistutor.com/wp-content/uploads/2009/07/posterousicon.png

@Rachael
As far as IE goes here is what I am doing and what I recommend you consider. I will find a fix as time permits. I’m actually working on a jquery based icon set that you may like more and that will work with IE. The problem is I’m behind on it. I’ll look at the IE fix this week, though. I’ve tried different things and none of them has worked. I believe that there is a bug in IE preventing span and anchor tags from having a background. I’ve seen some “fixes” but none that have worked.

This leads me to my next topic. Some people say they love IE, you just have to get used to its nuances. For me, it is those “nuances” that I dislike. Perhaps if we all encouraged our clients to use Firefox, Chrome, etc. we could not only make our jobs a bit easier, but we could usher our clients into a better web experience. For example, rounded corners and text shadows are already supported by Firefox and Webkit browsers, but not by IE. Ok, no more ranting ;)

Reply

Caleb October 8, 2009 at 10:33 pm

Matt,

This is fantastic. Great work. Would it be possible to get a Posterous icon from you?

Reply

Fatos October 20, 2009 at 6:18 pm

thanks for putting a video on how to do just that… i have seen the tutorial somewhere but ended up messing my site and had to delete, with a video like yours is just copy and paste and some changes here and there.

Reply

Leave a Comment

Previous post:

Next post: