WordPress Simple Facebook Google Twitter Share Buttons

I will describe the sharing button in WordPress in a very simple way. You can easily share pages on facebook, google plus and twitter with this group of buttons. WordPress facebook, google plus and we will not need a plugin to share buttons on Twitter. You can use facebook, twitter and google plus share button without plugin by putting the following code where necessary.

 

function.php

 

function share_buttons($url){
 
echo "<ul><li><a href=\"#\" onClick=\"window.open('http://www.facebook.com/sharer.php?u=" . $url . "','facebook-pop','height=350,width=600')\" class=\"btn-floating facebook-color\" title=\"Facebook\"><i class=\"dashicons dashicons-facebook-alt\" aria-hidden=\"true\"></i></a></li><li><a href=\"#\" onClick=\"window.open('https://twitter.com/share?url=" . $url . "','twitter-pop','height=350,width=600')\" class=\"btn-floating twitter-color\" title=\"Twitter\"><i class=\"dashicons dashicons-twitter\" aria-hidden=\"true\"></i></a></li><li><a href=\"#\" onClick=\"window.open('https://plus.google.com/share?url=" . $url . "','google-pop','height=400,width=600')\" class=\"btn-floating google-color\" title=\"Google\"><i class=\"dashicons dashicons-googleplus\" aria-hidden=\"true\"></i></a></li></ul>";
 
}

output.php

 

share_buttons(get_permalink());

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *