• In case anyone wants to put this like button on only specific pages, here is a simple way to add a shortcode for this plugin.

    Add this code into your theme’s functions file.

    function wm_fblike_shortcode(){
    
    	$button = null;
    
    	if(function_exists('fblike_get_iframe')){
    
    		$fblike_uri = get_permalink(get_the_ID());
    
    		$button = fblike_get_iframe($fblike_uri);
    
    	}
    
    	return ($button);
    
    }
    add_shortcode('fblike','wm_fblike_shortcode');

    Then, you can use the shortcode [fblike] in any post, page, or custom post type. If you’d like to use it in your template files, insert the following code into your template where you’d like to see the button.

    <?php echo do_shortcode('[fblike]');?>

    One usage note: if you’re using the shortcode or template tag, you’ll have to select the appropriate combination of “FBLikeButton Settings” on the plugin settings page to avoid showing the button more than once on your page.

  • The topic ‘FBLike Shortcode’ is closed to new replies.