trying to get my “Like” button to link to WordPress attached image URL.
Is it possible to “Like” just an image file?
Here’s what I have
<?php $large_image_url = wp_get_attachment_url( get_post_thumbnail_id(), 'large'); ?>
<div class="likeButton" style="float: left;"><iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode($large_image_url); ?>&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:100px; height:25px"></iframe></div>
Firebug shows it’s linking, but pressing like yileds no results to my FB page. Hewlp!
See my answer here: Like Button counts the likes of a PDF but does not actually post the activity?
You can’t like a file directly because the file won’t serve the metadata Facebook uses to display the ‘like’ story – you need to like a HTML URL, then include the image on that URL (or redirect users other than Facebook’s crawler to the image)