I have been asked many times, “What plugin did you use to get your social media sharing icons on your site?” Well, I didn’t use a single plugin to do it! Because of that, I decided to make a tutorial showing exactly how you can achieve the same thing.
Watch this short video for an overview of what we’re going to do.
1. Understanding the Design
Using css, we’re basically going to create a container that holds 3 different elements: (1) RSS/Email Links, (2) Social Media Sharing, (3) Ads. Everything within the container (including the 4 images) will be styled exclusively within custom.css.
We will be using a css 3.0 feature called opacity to create the hover effects. This will work flawlessly in Firefox, Safari, Chrome, and other trendsetting browsers; however, it will NOT be visible in Internet Explorer (the icons will show, the hover effect will not).
2. Understanding the Functionality
We will edit custom_functions.php to create the actual content within the box, including placing the images, links, and other features. Additionally, we will command the box to only show on single posts (not your home page or other pages).
3. Placing the Style
Open custom.css in your favorite editing application. Paste the following code into that file.
/*Stay-Connected and Share-This-Post Box*/
.box { margin: 0; padding: 0.7em; background: #e5f6fc; border: 1px solid #0262A5;}
.box h3 { margin-top: 0; }
.box p { margin-bottom: 0; }
.box .stayintheloop {float:left; width:58%;}
.box .social_icons {float:right; width:38%; }
.box .social_icons a, .box .social_icons a:hover {border:none;}
.box .social_icons img {filter:alpha(opacity=100); -moz-opacity: 1.0; opacity: 1.0;-khtml-opacity: 1.0; }
.box .social_icons img:hover {filter:alpha(opacity=50);-moz-opacity: 0.5; opacity: 0.5;-khtml-opacity: 0.5;}
.advert {background-color:#FFFFA0; color:#000; border: 1px solid #0262A5; border-top: 0; padding: 0.3em; text-align: center; font-size:12px;}
Of course, you can edit much of the above to fit your theme and preferences, but we’ll get to that in a bit.
4. Placing the Content
Next, open custom_functions.php and paste the following.
function post_footer () {
if (is_single()) {
?>
<div class="box">
<div class="stayintheloop">
<h3>Stay In The Loop!</h3>
<p>Insert RSS/Email Links Here</p>
</div>
<div class="social_icons">
<h3>Share This Post:</h3>
<p>Insert Social Media Links Here</p>
</div>
<div style="clear:both;"></div>
</div>
<div class="advert">
Advertisement: Created by <a href="http://MattFlies.com">MattFlies.com</a>
</div>
<?php
}
}
add_action('thesis_hook_after_post', 'post_footer');
Tip: Automatically shorten urls before posting.
5. Edit to your liking
The box should now be visible on your single post pages. Take a look at it, and start to input the appropriate links and content. Use FeedBurner to get links to RSS and Email. Links and icons for social media are provided by the respective service (e.g. Twitter, Delicious). You can also view a list of the most popular links, complete with the correct functions for your Wordpress blog.
Replace your information in the necessary spots as indicated in Step 4. Any images that you insert within the social_icons div will automatically have the hover effect applied to them.
Edit the css from Step 3 to fit within the parameters of your color scheme, theme size, and more. Just have fun with it!
If you have any questions about this tutorial or you successfully incorporated the box into your blog, let me know in the comments. Don’t be afraid to drop a link to your site!
