A

How to use a single image on Facebook when your website is shared

Ideally, you would want to use context specific images to be shown on Facebook whenever any page of your WordPress website is shared on Facebook, but if for some reason you want only a single image to be shown irrespective of the context, that can be configured using my plugin – [Facebook Like Thumbnail](http://wordpress.org/plugins/facebook-like-thumbnail/) though […]

Ideally, you would want to use context specific images to be shown on Facebook whenever any page of your WordPress website is shared on Facebook, but if for some reason you want only a single image to be shown irrespective of the context, that can be configured using my plugin – [Facebook Like Thumbnail](http://wordpress.org/plugins/facebook-like-thumbnail/) though it specifies context specific images by default.

You need to install the plugin, configure the default image to be used from the settings page. And then paste the following code in your functions.php file:


<?php
/**
* Plugin Name: Facebook Like Thumbnail – Force Default Image everywhere
* Plugin URI: https://gist.github.com/ashfame/62f59587aaa5c8ecb1ce
* Description: Forces the default image to be used as FB Thumbnail for every page
* Author: Ashfame
* Author URI: http://ashfame.com/
*/
add_filter( 'fb_like_thumbnail_shortcircuit', 'force_single_fb_thumbnail' );
function force_single_fb_thumbnail( $shortcircuit ) {
if ( class_exists( 'Ashfame_Facebook_Like_Thumbnail' ) && ! empty( Ashfame_Facebook_Like_Thumbnail::$options['default'] ) ) {
return Ashfame_Facebook_Like_Thumbnail::$options['default'];
}
return $shortcircuit;
}

This short-circuits the logic of the plugin and specifies the default image specified in settings to be used for all pages.

I see this use-case as being very limited to what everyone would want, so I don’t want this to be added as another option in the plugin itself, but it can be achieved using short-circuit opportunity offered by the plugin’s architecture. Even if you want to plug in custom logic to figure out the image to use, that’s possible too.

Let me know if you run into any issues.