Today, Facebook pushed live another change which made Like button work similar to what we had known the Share button to do. Just to brush up, Share button was used to show the Title, Description and a screenshot of the page which you shared and the Like button would only show up as a line that the user liked XYZ Story on ABC site. But now after the new change is live, like button functions the same as the Share button.
Here is a screenshot of how the new like would show up on your profile:
I don't like the move as people tend to like a lot more stuff than what they share. This is going to stuff the stream with lots of noise. After like is not, and can't be equivalent to share. I might like a post on Ubuntu tutorial but is that something I would want to share with everyone else. No! But that's totally a different story.
Coming back to the point, many sites would show up random image of their page instead of an appropriate image. I have seen this on several blogs including mine, that sometimes an advertisement image would show up (from the sidebar), or a totally unrelated image of my another project (from the footer). so, I took this opportunity today to fix it for everyone.
You can check what thumbnail would Facebook show for a particular page by using their Lint tool.
The problem can be solved for non-WordPress based or html sites or whatever, by adding this line to their head section.
<link rel="image_src" href="http://example.com/logo.png" />
This will show that image on every page. But in WordPress, we can do a lot more, that's because WordPress is a brilliant piece of software.
You can use the plugin to fix the issue. It will display the first image of the post or page you are on. In case someone likes your Category or Tag page, then the first image of the first post in the listing will be used.
You will need to edit a line which is highlighted in the code below to change the default fallback image to your logo so that whenever, the post doesn't have any image in it, your logo will be displayed. If you don't edit that line, then my logo will be displayed and I might sue you for that.
I have added a couple of features in the plugin, so I don't recommend you to use the snippet anymore. Using the plugin will make it easier for you to receive updates without touching any code. WordPress Facebook Like Thumbnail Plugin v0.2
In case, you don't want to download yet another plugin, you can add the following code in your functions.php file I recommend everyone to use the plugin version instead so that you can receive updates automatically.
Facebook crawls your page every 24 hours (at max), so you may not see the change right away but you would see it instantaneously, if you use the Linter tool once for that page because it updates the thumbnail for that page, right away.
I might add an options page for it to add an image if users request start coming up. Also I will host it on WordPress repositories once I get the time to, as I will need to look into it first.
If you have any question, you can ask in the comments. Also, please like it (not share) to share it with other fellow bloggers.