How to display a Facebook Share button in WordPress using a shortcode

Just add this WordPress Code Snippet to the functions.php file in your current WordPress theme in order to display a Facebook Share button using a shortcode.

/**
 * Display Facebook Share button using shortcode
 *
 * @author WPSnacks.com
 * @link http://www.wpsnacks.com
 */
function facebook_share_button() {
    return '<div class="fbshare"><script src="http://widgets.fbshare.me/files/fbshare.js"></script></div>';
}
add_shortcode( 'facebook_share', 'facebook_share_button' )

Then just use a shortcode such as this to display your Facebook Share button:

[facebook_share]Some text here[/facebook_share]

Hope this helps, enjoy.

   Related Sponsored Links

Disclaimer: The information contained in this website is for general information purposes only and in no event will this site or its owners be liable for any losses or damages associated with your use of our site or content. Click here to see our full Disclaimer.

Leave a Comment

*