Today I’ll show you an easy way to add a Facebook like button inside your WordPress posts.
I’m going to create a WordPress shortcode that will allow you to enter the simple code nttfblike between brackets to paste a like button any where in your posts.
First you need to get your code from here Facebook Like Button. You can define how you want your personal like button to look by defining :
function nttfacebooklike() { // Put your Facebook code between the quotes that follow return return '<script>(function(d){var js, id = \'facebook-jssdk\'; if (d.getElementById(id)) {return;}js = d.createElement(\'script\'); js.id = id; js.async = true;js.src = "//connect.facebook.net/en_US/all.js#appId=148750305214974& xfbml=1";d.getElementsByTagNa me(\'head\')[0].appendChild(js); }(document));</script><div class="fb-like" data-href="http://www.facebook.com/newthinktank" data- send="true" data-layout="button_count" data-width="200" data-show-faces="false"></div>'; } add_shortcode('nttfblike', 'nttfacebooklike');
Leave a Reply