Add Social Sharing Without Plugin

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email

Last Updated: July 25, 2020 | Reading Time: < 1 minute

Its annoying if you want to use the social sharing button, but the plugin you choose bloated with numerous unused features and ads. The best way is to include your own social sharing feature.


It’s a quite popular social media platform, to add this to your theme, facebook use this following URL:[permalink]

So you can create a link using the above target and add url of the page so the end of the code in WordPress should be like this

<a href="<?php the_permalink(); ?class="ps-share">Share to Facebook</a>


For Twitter the url for sharing more or less are the same, but Twitter has abilities to add Text automatically to the share interface:[url]&text=[text]

So the code in WordPress should be like this:

<a href="//<?php the_permalink(); ?>&text=<?php echo urldecode( get_the_title() ); ?>" class="ps-share">Share to Twitter</a>

I will update this post later on with more social media sharing code.

Make Them Pop

To pake the sharing window as a popup, instead of opening in current window, use the code below.

$('.ps-share').click(function (event) {$(this).attr("href"), "popupWindow", "width=600,height=400,scrollbars=no");

Any idea? Fill the comment below

This site uses Akismet to reduce spam. Learn how your comment data is processed.

More To Explore