So as it currently stands there are some pretty sweet social media plugins and even some killer social media tutorials out there for Thesis, but personally I wanted to roll something custom for Art of Blog.
Thesis Social Media Icons Video:
Today’s video will show you how to quickly implement sleek unobtrusive social media links/smart icons to your Thesis site without a plugin. These smart icons can be found right under this posts’s title.
Implementation
Now that you have watched the video on how to implement the code its time to grab the code below. Simply add these two snip-bits to your custom_functions.php and custom.css and you will have a slick looking social media setup.
Add to your custom_functions.php
Make sure to change $twitter=’artofblog’; to $twitter=’[Insert your Twitter Account]‘;
To implement the code below simply copy and paste it into your custom_functions.php. Don’t forget to add your twitter name. This code sets up the social media “smart icons” along with the HTML to allow us to effectively style it.
<?
function social_icons(){
if(is_single()){
$twitter='artofblog';
global $post;
?>
<div class="social">
<strong>Spread it!</strong>
<div class="social_button dg">
<a class="DiggThisButton"><img src="http://digg.com/img/diggThisCompact.png" height="18" width="120" alt="DiggThis" /></a>
</div>
<div class="social_button tm">
<script type="text/javascript"> tweetmeme_source = '<?php echo $twitter; ?>'; tweetmeme_style = 'compact'; </script>
<script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script>
</div>
<div class="social_button fb">
<a name="fb_share" type="button_count" href="http://www.facebook.com/sharer.php">Share</a>
</div>
<div class="social_button su">
<a href="http://www.stumbleupon.com/submit?url=<?php the_permalink(); ?>&title=<?php the_title(); ?>" id="stumbleupon" target="_blank"><img src="http://cdn.stumble-upon.com/images/badgeStumble.png" alt="submit to Stumble Upon"/>
</a>
</div>
<div class="social_button em">
<a href="mailto:?subject=Sharing: <?php the_title(); ?>&body=I wanted to share this with you. Thought you might enjoy it:%0A%0A<?php the_permalink(); ?>" title="Email This" target="_blank">Email This</a>
</div>
</div>
<div class="clear"></div>
<?
function digg_footer(){
echo '<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>';
echo '<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>';
}
add_action('wp_footer','digg_footer');
}
}
add_action('thesis_hook_before_post','social_icons'); ?>
Add to Your custom.css
Now that we have added the smart icons we need to style them. Please make note of the .social{margin:-15px auto 10px;} You may need to change the -15px to something else depending on your customizations.
.social { border: dashed #ddd; border-width:1px 0 1px 0; margin: -15px auto 10px; display:block; padding: 3px 0 1px 0px; overflow: hidden; }
.social .social_button {float: left; display: inline; overflow: hidden; height:22px; }
.social .social_button.dg { margin: 0px 0 0 20px ; padding-top: 4px;}
.social .social_button.tm { margin: 0px 0 0 12px; padding-top: 4px;}
.social .social_button.fb { margin: 0 0 0 15px; padding-bottom:0px;}
.social .social_button.su { margin: 0px 0 0 30px; padding-top: 2px;}
.social .social_button.em { margin: 0 0 0 20px; padding-top: 0px;}
.social .social_button.em a{background:#eee url(images/emailthis.gif) 3px 50% no-repeat; padding:2px 3px 2px 20px; font-size:10px; border:#ddd 1px solid; text-decoration:none; -moz-border-radius: 3px; -webkit-border-radius: 3px;}
.social .social_button.em a:hover {background:#ddd url(images/emailthis.gif) 3px 50% no-repeat}
.social .social_button a img { border: 0; padding: 0; }
.social strong { font-size: 11px; float: left; margin:2px 0 0 0; color:#555;}
.clear{clear:both;}
Closing:
Matt Langford created an awesome post on how to add the Facebook like button with Thesis. Make sure to check it out.
Note: Thanks to the help and suggestion by Scott Wyden we have added “Email This” functionality. Here is the image you need
. Right Click -> Save Image as. Make sure you grab the email icon and add it to you custom/images folder.
Hopefully this quick tutorial has helped you figure out how to implement social media into your Thesis Theme.
If you have any questions on implementation or the code please feel free to leave us a note in the comments.
Get Free Updates From Art Of Blog
Sign up to receive insider tips only available to our email subscribers.
You can also subscribe to our RSS feed or follow us on Twitter to get the latest updates. Check out our YouTube channel for the latest video tutorials!





Top 25 Tutorials for Thesis Newbies
Two Sure-Fire Ways to Increase Website Traffic
Introduction to Custom CSS in Thesis
Installing and Optimizing Thesis Theme for Wordpress
Thesis Recent Tweets with @Anywhere Integration
Thesis Wordpress Theme Review
180+ Thesis Design Customizations You have to See to Believe
Using WordPress Pages like a Pro
What’s in It for Me: 7 Types of Timeless Core Content
{ 97 comments… read them below or add one }
Hey Nick,
i loved the idea. But the code you gave didn’t work. Then i deleted some spaces between the php (<?) tags and it worked fine..! Thanks for sharing..!
I’ve added closing “?>” and opening “< ?)" php tags to the statement. That might have been the issue. Make sure that all of your custom_functions.php is wrapped in tags.
wow thank you Nick Reese but hot to insert reddit button
Use the following code.
Came out great!!
email this dont work my blog and artofblog
Please go into more detail. What isn’t working?
He may be refrying to the fact that this type of email link will show an error if a user has not set a default email client for their machine. This solution would be better with an email form for the email option.
Hi,
I also tried this and it doesn’t display anything at all.
Thanks
Also, I checked the customs_functions.php file and the code that I inserted disappears! Tried it 3 x . same results every single time. thanks.
This really great, thanks for sharing. It works great on the pages of my indiviual posts, but isn’t showing up on my homepage. Any idea how to get it on my homepage. http://www.trackfocus.com. Thanks.
@Jim,
remove the if(is_single()){ at the beginning of the function. Also remove the 2nd to last }. This will force it to show on every page.
Nick-
Thanks for the tip. I appreciate it.
Hi,
Do you have any ideas why it won’t display? I sent the email twice on January 16. Thanks for your response.
hi,
i had to get rid of the <? at the beginning and it showed up. also since i have a colored background, the digg button box is white, how do i change it to match my colored background, same for the email box?
thank you
Ken sounds like you will need to make a custom image for the digg issue.
The email box just change the CSS to match your background.
hi nick,
sorry, so how do i make a custom image? new at this. because it looks like only the submit button is an image, everything else is text and looks like a white box.
thanks
The only bad thing about adding all of these buttons is they tend to slow down load time. With Google now calculating page load time as one of their ranking criteria that could hurt SEO.
I prefer to add static buttons. Of course, if you do that, you can’t display how many retweets there are etc.
You just have to decide whether or not the social proof is worth it for you which is totally dependent upon your situation. If you’re Darren Rowse, you probably sacrifice a bit of load time in order to gain all the cred you get from having your articles tweeted, stumbled, etc. hundreds of times. If you’re me, you go with static buttons ;)
I can definitely agree. Debating about having a time conditional for new posts. That says hey, if this post is within 2 weeks old, show the active buttons. Otherwise, show static.
Just gotta code it and get the images lined up. Need more time!
I’ve tried several times to get this working with no success. I have copied the code over to custom_functions.php as instructed, and can’t figure out what I’m doing wrong. I tried troubleshooting it myself but I’m pretty new to coding and lack the knowledge. Right now I have a clean wordpress and thesis 1.6 installed. Is there any advice you could give on this?
The code shown on the page will only show the icons on the actual posts. This was done to keep load time down. Are they showing on the Single pages?
Well Nick, I now feel really stupid :) lol. I didn’t realize they only showed up if you opened them. Thank you for the quick reply.
Hi,
Still trying to figure out how to change the iframe body from white for the digg button to match my background color. Any ideas?
Thanks
Thanks. Really cool. Do you know how I can show the number of diggs and number of shares on FB and also stumbledupon, for example, just like the retweet one?
Hi nick!
I have copied the code exactly in the way you instructed but don’t know why single post pages are not loading at all (getting complete white page). I tried doing it more than 10 times but got same result everytime!
Can suggest me how to get this code working?
Sounds like you are having a php error. Make sure you don’t have duplicate
< ? ? >tags.Looks like you’re having a similar issue as to what I’m having with the Facebook Share button. It doesn’t pass the article title or description. Any ideas?
In my tests it is working. Are you logged in?
I literally just got it working on my site. On your site, it still isn’t passing the article title or content while logged in using Chrome or Firefox. Just the site name, url and thumbnail.
Got it to finally work! Thanks! Even got the reddit bumped in there and everything. (yay negative values!)
Hi,
Great code! I am having one issue. I use Yahoo mail, when I click the Email This link, it opens up two windows in my Yahoo mail and neither contains the link in the email body. Any ideas how to fix it?
Thanks!
The mailto: tag is mainly supported by outlook and other email clients that reside on your computer. Web based email clients often won’t recognize the mailto: protocol.
Ps. Awesome to see Thesis running a site in my hometown! I grew up in Bradenton lol.
Awesome tutorial – thanks.
What I want to know is how to do the “Subscribe” menu on the right column with the rss, email, twitter, and youtube icons.
Any chance of another tutorial for that?
Thanks!
Hi Nick,
Awesome site!
I seem to be getting a recurring parse error that just doesn’t seem to go away. Have tried deleting the operators and all of my custom php to isolate the problem but still no go.
The error I get is attached below:
Parse error: syntax error, unexpected '< ' in C:\xampp\htdocs\wordpress\wp-content\themes\thesis_16\custom\custom_functions.php on line 11Anything on this?
Cheers,
Avi D
Avi,
It seems many people may be having the issue you are having. I have created a video to help you understanding what is happening.
You are running into a simple php syntax error.
When I was getting started I used these tutorials to get a jump start on PHP.
http://www.phpvideotutorials.com/free
Thanx a ton for the assist Nick but it’s kinda weird how it seems to be working for you and not for me!!! Maybe it’s because I’m on a local install via xampp?
Weird….but the odd thing about this bit of code is it works beautifully on one local install while it just refuses to work on another!
On my personal laptop, it absolutely refuses to populate while on my work desktop, it works like a charm. This is so strange…the flipside is: at least I know it looks HOTT when used!!Thanx again Nick for putting this tut out and the video too…much appreciated. :-)
Actually having a Social Media icon on thesis can make the theme more professional and more user friendly too…….so that peoples can easily share their favorite things from your blog to anywhere he/she likes.
useful post for the Social Media lover like me.
Hi Nick,
Loving this style!
One question though.. I have no sidebars on my site and have centered everything.. what css would I need to center all these icons?
Many thanks
Great tutorial Nick – the social bar you made looks very clean and professional. I implemented this on my site with no problems. Thanks for putting it together!
Thank you so much for the walkthrough – adding this became much easier for a Thesis newbie.
The “Email This” button isn’t displaying an envelope icon like the one on your site – any ideas of what’s going on? I copied and pasted as you directed (although I deleted the Digg portion but the Email This was already looking that way before the delete).
Thanks in advance for the help.
Dr. Jay,
Did you download and upload the email icon? That will need to be on your server in your custom/images folder.
Didn’t work for me, broke my custom_functions, had to reload the file on he server from the back up. I just copy-pasted the code above into functions.
I can’t help you without the error it created. You probably forgot to remove the < ? or ?> at the beginning or the end.
Nick, I thought the were supposed to be there, so I did not remove them. Let me remove them and try again.
Yep, it worked without the tags. Thank you!
I hadn’t but now I’ve downloaded “an” email icon (don’t know if there’s a specific one you’re referencing) – it’s in my custom/images folder but no change.
Do I need to alter the code in the custom_functions.php to point it to this image?
Check the very bottom of this post in the yellow box.
Don’t see a yellow box here.
oops, there it is – found it.
dragged it in there (the custom/images within the thesis_17 folder in wp-content/themes) – still doesn’t show up.
It needs to be saved as “emailthis.gif” in the /wp-content/themes/thesis_17/custom/images/” folder.
Ahh, it was in the folder but saved as “emailthis.gif.jpeg” for some reason – changed the name and it’s working fine.
Thank you so much for everything – the post, the instructions, and especially the quick and thorough follow up on my questions/challenges. You’re great!
Nick, this is exactly what I want to do. However, I have custom built a theme using Artisteer software.
Can you show me how to implement this code into a different theme?
I tried using it as is, but then the WP doesn’t load and neither does the site. I have to go and delete the added section in functions.php manually through ftp to get back into wordpress.
Which parts of your code are only for Thesis, and if I wanted to add it to a different theme, how would I do this??
How to add a Google Buzz button?
I founded how to add google buzz button.. http://www.google.com/buzz/api/admin/configPostWidget
But now I can’t remove the digg button of my footer!
Take a look.. http://www.gadgetblog.com.br/
Remove the 2nd function labeled “digg_footer”
Thanks for the quickly reply Nick!
But I got another problem, when I remove the if(is_single()){ at the beginning of the function and also remove the 2nd to last }. Shows up on every page.
BUT, when I click to share at the homepage, just share all my homepage, and no my post link.
Take a look.. thanks!
Marcell,
The code was designed to be on each single page. If it is on the home page, it will tend to clutter your site.
If you still want to go that route you will need to work with the tweetmeme api, to specify the post url.
Hello
Can’t seem to get this working. I have Thesis 1.7, and am a bit of a newbie when it comes to Thesis.
I have followed this site verbatim, and have even tried all the suggestions in all of the comments, but nothing seems to be working.
When I enter the code into my custom_functions.php file and hit save, it’s all erased when it reloads. I’ve removed many ?> <? calls and that made it worse.
A bug with Thesis 1.7?
Any ideas?
I’m wondering about Thesis 1.7 as well – none of the above comments have helped me eliminate the syntax errors. I’m editing my file directly in BBedit & Dreamweaver CS5 (which balks about the code as well). Is there a chance of an update on this tutorial?
Best,
Nate
Nathan,
I’m glad it’s not just me – thanks for confirming that with your blog too.
I hope we can get an answer soon! :)
Hey guys,
I’m on the road, but I just recorded a video tutorial of installing it on 1.7. Give the video a couple minutes as I just uploaded it but I’m walking out the door. Youtube is still rendering as of the time this comment was posted.
Nothing changed really, but maybe watching the installation process again in Dreamweaver may help.
If you are still having issues make sure to copy the error code php gives you and relay that in the comments section.
Thank you for this Nick! I will check it out when I get home and the video is ready to be watched.
As a quick note, there was no PHP error from before. I would enter the data into custom_functions.php using the Wordpress web interface. I would then hit Save, Wordpress would refresh the page and custom_functions.php without the entries I just made. If I entered this at the top of my custom_functions.php, it would erase everything in that file. Thankfully I had a backup.
It’s really quite weird. I’ll give it a go in a plain text editor in a bit as well.
I’ll let you know the outcome!
Like magic, it worked – but only using a text editor (such as Vi). When I try it through the web interface it messes up. Not sure why, but not sure I’m going to question it either?
Thanks again for the video!
I just installed this on my Thesis 1.7 blog and noticed that there appeared to be a hidden character when editing in the file editor as the syntax highlighting was all messed up.
Before saving, I had copied to Textpad to do some tweaking and noticed an extra question mark at the top. Removed all leading white space before the function call and then the file editor no longer had any issues.
Thank you Nick – I watched your new video and backed into it one piece at a time starting with the social buttons, then carefully added back in my other customizations and it’s working great. I appreciate your help!
Okay, I think I’ve totally screwed this up and now can’t even get back to the custom.function.php to put back what was originally there. Help!
Hi Nick thanks for explain us with patience but I have a few questions about Thesis,
The slogan of thesis is “do more code less” “never have been so easy modify a theme” ok for me this slogan is not true , because of the dificult to put a simple social buttons and so on.
what do you think?
Personally I think Thesis is the easiest theme out there to use. Way easier to get it to do custom things than coding your own.
I’m with Nick – with hooks, Thesis makes it so easy to map out customizations. Not to mention SEO awesomeness.
I’m in agreement with both Nick and Nathan. Even for people that don’t possess the technical coding ability to work with the hooks – and don’t want to learn – there is still a great deal of customization exposed within the design and site options of Thesis.
Once you add in the ability to do truly custom things with the hooks and filters, you can open the door to some amazing designs.
Juan, I know what you mean – I bought Thesis so I could spend less time coding, but I still seem to spend a lot of time doing so. That said, I would much rather use Thesis as a basis for a WordPress site than any of the free themes around, so I guess I am with the other guys too.
Nick, thanks for sharing!
Why is it that even though the following is in the php code:
mailto:?subject=Sharing: &body=I wanted to share this with you. Thought you might enjoy it:
The resulting text when you do email is all lower case like this:
i wanted to share this with you. thought you might enjoy it:
Also when it php’s the_title, that ends up all lower case too rather than upper and lower like the title really is.
Thanks.
Another two questions:
The digg icon seems to have css issues I can’t figure out. It does not align correctly with the other icons. You can see this here: http://willtaft.com/contemporary-issues/water-will-be-the-next-oil/
Also I know this is set up only to display on the single pages, but a lot of people read the most recent posts from the blog page and it would be helpful to have the icons there too. What would I do to get the icons on the blog page also? I can’ seem to find a hook that would place them both on the sigle post pages and on the blog page which has the few most recent posts.
Thanks!
@Will I think I might actually be able to finally help someone! I’m fairly new to all this, but using Firebug I sorted out the misaligned Digg icon. I ended up adding this to custom.css:
.custom .db-wrapper span span span.db-compact {
position: relative;
bottom: 4px;
}
Should work for you too.
Sweet, thanks! This is great. One question…how would I repeat this at the end of my post?
Forget it, answered my own question :)
Hey Carlo – Thanks. Hopefully Nick or someone will have an answer to my other two questions. The capitalization is an odd one. The method of getting to place on the individual posts on the blog page may be something I can eventually figure out. A long time ago I had hard coded a digg button to work both on the single page posts and on individual posts on the blog page. (In other words, not targeting the blog page itself, but the separate posts displaying on the blog page.) If I can dig(g) up that old code, I may have a clue.
Also if you post how you are repeating this at the end of your post, it may help someone else in the future who is looking to do that.
And – I looked at your site. Great job! Nice customization of the Thesis theme too. Your logo/header is super also.
Thanks Will. And thanks for the comment on my other site :) I’m glad I could finally help someone after getting so much help from the Thesis forums and sites like these. In fact, I’m still waiting to hear back from a couple posts in the forums. I’m stuck trying to figure out how to add thumbnails to custom excerpts.
As for repeating it after the post…I figured two ways:
1. Duplicate the code and change the main function name and the Digg function name within the main function, and then add it to the after_post hook (or wherever). If you don’t change the Digg function name in the second instance you get a PHP error.
2. The other way, which I preferred, was to remove the Digg function altogether and stick the Digg and FB scripts up in the function. This way I didn’t have to duplicate the whole function, but just did another add_action with the appropriate hook. (I don’t fully understand that Digg function, but I think it was just to put the Digg button in the footer…could be wrong).
In the end I didn’t use it because for some reason the buttons were all misaligned in the bottom instance. And I didn’t feel like messing around with more CSS…so I’m gonna live with it just in the top. If I feel like figuring it out later I might try again.
Nick,
In your code section, it starts with div tag but in your video, you copied the entire code including the starting of a function syntax. Am I missing something?
Is it just me, or the code shown in the video is not the same as the code in this post?
I copied the code and my site crashed. The code in the post doesn’t show the function, $twitter and it has some weird staff as .
Don’t know why this is and if I am the only one who has this problem, but I would sure love to use this on my site. Hope you can let me know what I am seeing or doing wrong.
Thanks
DB, thanks for pointing that out. When we updated to the new site design and added the “summary” box the built in wordpress editor mangled our code. I reverted to an old revision and the new code should work.
Nick,
Can you double check the new code that you posted. I still got an error on the code. I notice there is a ?> on the line of
add_action(‘thesis_hook_before_post’,’social_icons’); ?>
Mike, figure it out?
Depending on where you place this function in your code you may or may not need the final “?>”
I guess I really suck at php. I used to be a .net developer so I still learning php. I must not have the tags in the right place in my custom_function.php file. Email me so I can respond to you in more detail, if you have time. Thanks in advance.
Hi Nick, thanks for the update, I was sure I was doing something wrong. I hope this will work now as I really digg this cool spread it social icons bar. Was looking for this exact this for quite some time.
Thanks
I have the buttons showing on the feature post on the front page.
Is there a way to make it so when someone tries to share the feature post from the front page that is links to the actual article, instead of the main domain name?
Thanks.
Hey Nick,
I love the style/placement of your social icons and I am seriously considering adding them to my blog. One question before I do that is, will i maintain the history of past retweets with the numbers in the twitter icon if I delete the old twitter social icon and add your social icons? To be more specific, if you go to this one blog post – http://rbeale.com/social-media-marketing/twitter-followers-how-to-identify-quality-and-relevant-twitter-users/ I have 99 retweets and would like to maintain that retweet history if I switch over to using your social icons.
Thanks!
Ryan
The button is handled by tweetmeme, it pulls from their API. If tweetmeme recorded the retweet then you should be good. Since you are using tweetmeme currently. I wouldn’t foresee a problem. :)
Sick! Thanks!!
Followed the video and removed the tag Nick. Still doesn’t work. I am using thesis_17, if it makes a difference. Gives the syntax error.
Awesome Tutorial!!! I for sure added this to my blog and it was easy to do!!
Thanks!!!
Hi Nick. I really love this idea. I’m using version 1.7 for Thesis and it’ll work great on the initial save but if I have to modify the code further I get problems with my pluggable.php file on a certain line. Thus, I would constantly have to upload my backup custom_functions.php. Anyway you can perhaps integrate this as a Thesis Openhook pastable instead of modifying it through this way? Would appreciate the response when you can.
Thanks!
Thu
I was wondering how I would remove the email and digg functions?
Great tutorial guys. I have put it into effect and you can see it on here http://grievousbodilycharm.com/2010/07/04/ice-cream-2010-fallwinter-collection/ :)
{ 5 trackbacks }