For every social network there are 20 WordPress plugins to add their icons and scripts to your website. And in doing so, most will weight and slow down your pages. Some of these even force it on every page of your website. Some social networks include multiple js files along the way for tracking. No one needs all that weight. Here we’re going to explore a way to make light weight social share buttons using only their share links. This is applied for WordPress but can be altered for any website type. At the end of this post is an example set.
First we’ll look at the bulk of the code needed to add to your functions.php of your theme. Again, we’re working with WordPress for this example.
https://gist.github.com/bnecreative/aaebaa1829936aa51bd5#file-functions-php
Once you have that in your theme’s functions.php file, then you would use bne_share_buttons() to call it where needed. The list includes Facebook, Twitter, Email, Google+, Tumblr, and Twitter. There are others you can add to the list if needed. One important note, it’s written to use FontAwesome for the icons. Of course, you can use images instead or another font stack by adjusting the CSS.
Next we have some basic CSS.
https://gist.github.com/bnecreative/aaebaa1829936aa51bd5#file-style-css
And finally some optional JS. This will set the links to open in a small popup window to allow the user to customize the information being shared.
https://gist.github.com/bnecreative/aaebaa1829936aa51bd5#file-scripts-js
Simple, light weight and to the point. This won’t add any load time to your website.