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
- 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
- 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 }
Next Comments →
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!
Matt-
Here you go:
http://thesistutor.com/wp-content/uploads/2009/08/friendfeedicon.png
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.
Not sure. I’ll find out.
Matt, thank you so much for these tutorials!
Fabi
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
Thanks! Let me know if I can make any icons on the list for you.
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!!
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!
http://thesistutor.com/wp-content/uploads/2009/07/diggicon.png
http://thesistutor.com/wp-content/uploads/2009/07/deliciousicon.png
http://thesistutor.com/wp-content/uploads/2009/07/myspaceicon.png
http://thesistutor.com/wp-content/uploads/2009/07/stumbleuponicon.png
http://thesistutor.com/wp-content/uploads/2009/07/youtubeicon.png
Thanks a bunch Matt!
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
Eric-
I blame it all on beer. Made the appropriate changes and all is well. Thanks for pointing that out!
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?
Miraz-
Updated code. No validation issues at all
http://validator.w3.org/check?uri=http%3A%2F%2Fthesistutor.com&charset=%28detect+automatically%29&doctype=Inline&group=0
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-
@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).
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..
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
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
@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.
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
@Max
http://thesistutor.com/wp-content/uploads/2009/07/viddlericon.png
For some reason I thought I needed to put my own url into css. I’ve pretty much figured it out.
Thanks
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
@Max
Yeah, man. I posted it yesterday under “special cases.” Look above in the article.
nice work, any chance you can make one for shelfari?
@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!
Matt,
Thank you for the great work you do. You are such a good teacher!
hrm, oddly putting it in thesis_hook_before_html makes everything else on the page drop below for me…
@Lon
It shouldn’t, but you can put it in thesis_hook_after_html, too.
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
I tried that, for some reason everything floats to the top left. can’t figure out it out for the life of me…
Sorry Matt, didn’t catch the special classes insert the first time around. Thanks a lot for the great work!
Cheers,
Max
Hey Matt,
Awesome tutorial and icons. Could you do a Flickr one by any chance?
@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
finally got it working , had an extra } hanging around somewhere screwing everything up. Thanks!
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!
Hi Matt,
I followed the steps and it worked on Safari, but not on internet explorer. Is this unusual?
Thanks again,
Lisa
Great tutorial. I’m switching my blog over to the thesis theme this weekend and will try this out!
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.
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!
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.
Hey, Matt.
How can I use this in other themes apart from Thesis? Please advice.
@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.
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
@David
Sorry it took so long to get back to you.
http://thesistutor.com/wp-content/uploads/2009/07/vimeoicon.png
Hi Matt, fascinating tips.
Would you consider Spoke and LinkedIn, too?
Thanks- T
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.
Hi Matt,
I was just wondering if I could manage to have the icons in a horizontal row instead of a vertical one. Any hint?
I really love your tutorials – it is great for such css-illiterate people like me
Thanks a lot,
Damaris
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.
This is amazing!!!It’s exactly what I wanted!!!
@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.
@Mary Ann
That linkedin icon is for you, too
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
I’ve been looking for a tutorial like this for ages. Thanks!!!
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?
The icons are quite a success on our new website. Thanks a lot, Matt!
Any idea about putting them horizontal, yet?
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!
@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.
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?
@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.
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
@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
Matt,
This is fantastic. Great work. Would it be possible to get a Posterous icon from you?
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.
Next Comments →