Building Your Own Social Sharing Plugin for WordPress

Originally published at: http://www.sitepoint.com/building-your-own-social-sharing-plugin-for-wordpress/

A social sharing plugin allows your website visitors to share your website content easily on social media sites. This helps to increase the overall awareness of your website.

There are already dozens of existing social sharing plugins that you can just install and be done with it, but where’s the fun in that?

In this tutorial, I’ll show you how to build your very own social sharing plugin for WordPress from scratch, which can add social sharing buttons below every post. Users can share the post simply by clicking on the desired social media site button.

Why Do You Need Social Media Share Buttons?

It’s often reported that more than 80% of users consider reading content based on their friends’ recommendations. With social sharing, you give users the ability to share your content with their own networks of friends.

More than 40 billion shares are clicked each day on the web, therefore adding social sharing buttons on your WordPress website is first step to helping to market your site.

Continue reading this article on SitePoint
2 Likes

Hi, thanks for a great article.
I’m a WP noob, how can I show the Social Share above the post ? You show how to display it below, but not above.

1 Like

Replace

return $content = $content . $html; 

with

return $content =  $html . $content;
2 Likes

Hi,

That’s exactly what I thought, but it doesn’t seem to work…

Just tried It works for me. May be some plugin is stripping the HTML from post for your site.

Thanks, it was actually my theme, for some reason, but I managed to fix it. Thanks again for a great tutorial.

Great article. It is very helpful :slight_smile:

I have a WordPress site and this article is very helpful, thank you.

Thank you for your very very important information and sharing plugin for wordPress idea, really great article and very helpful, thanks again.

Regards
abul

I need to display social sharing in my footer and it won’t display in m post and page. For example your site footer . Plz help me out

Good stuff to get started rolling your own here. Take it a step further by integrating Font Awesome for social media icons (it’s quick: add their CDN link code then drop the elements into the HTML as needed), for example:

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">

Loads the library

<i class="fa fa-twitter"></i>

Would generate a nice Twitter icon without the use of an image and will allow you to style it up with stacked icons, colors, sizes, etc.

Take even a step further by integrating some call to actions with interactive toolbars that might slide in our out to emphasize your social media access. Hello Bar is well known for this. There’s some other solutions and even a way to DIY your own Hello Bar if you’re into rolling your own.

I have the same problem of not appearing beside “share on” how do you fix this please?

Thank you very much for this article :smile:
What about the idea of auto-posting??? please help?
what about the idea of choosing some people (friends) only or groups?? can we do this please help?

I’m not sure why, but the wp-admin panel under settings > social share is blank. :frowning: I cannot figure out that I’m doing anything wrong.

Problem with caching or something. It’s there now. Silly Me.:flushed:

.Hi, thanks for a great article.
That’s exactly what I thought, but it doesn’t seem to work.

This was a great–super easy to implement and style. One issue, recently noticed that LinkedIn has stopped working?! Google+ and Facebook will pull the OG information but Linked in only populates with a generic article link–no featured image, no excerpt, no title…

Any ideas? Google+ and Facebook works as do the other options…just not LinkedIn.

Hi great tutorial… I have a question what if i want to add option where i can select where to show added social share buttons like only on posts, pages, homepage, categories, excerpts and archive etc.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.