You are here: Computer Video TutorialWordpress TutorialWordPress Floating Social Media Button
Due to regular updates on WP, if you look for Twenty Eleven theme modification or customization tutorial, first of all, first check this post. Thanks.

WordPress Floating Social Media Button

by Kimi on September 28, 2010

How to create Floating Social Media Button without plugin using wordpress 3.0.1 Twenty Ten theme

In today tutorial we are going to add some code in your post page that will show nice fade in and fade out on mouse effect and also valid xhtml.

If you use other theme than Twenty Ten, it will work the same, by pasting the code in single.php as well.

We will have buttons of Digg, StumbleUpon, Facebook, Google Buzz, and of course Twitter.

I choose only Google Buzz and Twitter for this blog because it slows down my site’s speed due to connecting to these social bookmarking servers.


blog seo

End Result.

So let’s start it!

1. Go to your dashboard/appearance/editor

2. Look for single.php file. Most theme have this file.

3. Now find this line: </div><!--.entry-content--!>
Below that code, there is a code: <?php if (get_the_author_meta

Paste this code (in .txt file)  between those two codes. (see image)

4. Click “Update File”.

5. Now we look for stylesheet, style.css file.
6. Right in the very bottom, paste this code:
/*float social media buttons*/
#floating-menu{background-color:#fff;border:1px solid #ccc;position: fixed; left: 50%; top: 342px; margin-left:-554px; z-index:100;}
#floating-menu .float-title{padding:1px 3px;}
#floating-menu .float-title a{color:#000;text-decoration:none}

7. Click “Update File”. This css style was made for Twenty Ten, it means, if you use another theme, you can change the top and margin left position accordingly.

That’s it. If you want to avoid using those many buttons, you can delete any codes you don’t want to appear, example, if you delete this code;

<div>
<script type="text/javascript">
(function() {
var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];
s.type = 'text/javascript';
s.async = true;
s.src = 'http://widgets.digg.com/buttons.js';
s1.parentNode.insertBefore(s, s1);
})();
</script>
<a></a>
</div>

The digg button won’t show up.

Also important to Check in W3C validator if your document valid, it should pass, if not, then it can be caused by other things.

Reasons why i do not want to use any plugin for this, because i am reducing plugins usage to optimize my site loading speed plus plugin can cause error codes.

Subscribe new tips via Email:

Was the post helpful? Share it to help others with:

{ 11 comments… read them below or add one }

Stephen Fleming September 29, 2010 at 6:45 am

This video is fantastic and this site through give the information about the how to improve your own site.

Reply

Dina September 29, 2010 at 7:19 am

Thank you for your nice comment Stephen.

Reply

kbharath October 6, 2010 at 10:17 am

great tutorial, thanks for sharing, this helps for the bloggers who are not good at html and css to understand.

Reply

Dina October 6, 2010 at 1:49 pm

Thank you Kbharath!

I hope the same too.

Reply

DiTesco December 17, 2010 at 3:01 pm

Thanks Kimi for leading me here. I’ll try to install this on a dummy site first to see if I don’t mess it up :) If it all works out dandy, I’ll risk it on my Thesis theme. After a while, I got somewhat familiar with the custom_functions.php of it and I am always “afraid” to mess with it. I do backup everything first though just to make sure I have a “wayback” machine if needed, lol. Thanks again.

Reply

Kimi December 18, 2010 at 7:16 am

Hey DiTesco!

LOL, yes, i always use dummy site too to try stuff, best is to install wp locally, quick links:

Window users: http://www.blog.web6.org/install-wordpress-locally-windows/
Mac users: http://www.blog.web6.org/install-wordpress-locally-mac/

Cheers!

Kimi.

Reply

Vinay June 11, 2011 at 1:54 pm

good article thanks for sharing

Reply

Deepika June 24, 2011 at 8:39 am

Thanks for sharing. i will try it on my site.

Reply

Sueli August 26, 2011 at 5:02 am

Thanks! It took me a few minutes!
I used it on Twenty Eleven and it worked!

Reply

Kimi August 26, 2011 at 6:55 am

Hi Sueli!

Welcome to this blog, I have seen it, very nice indeed!

Thanks for coming accross and leaving commment

Kimi.

Reply

Waseem October 31, 2011 at 5:43 pm

Thanks alot, that really great work, thanks :))

Reply

Know better? Feedbacks, or Questions? Shoot! :-)

Please use a name instead of blog name or SEO stuff, otherwise it will be deleted right away.

About checkbox → See more my post:how to get rid of spam bots in wordpress post.

Thank you for visiting, you're always welcomed to be here again!

Previous post:

Next post: