Many Pies

Many Pies

Friday, August 21, 2015

Facebook featured image on Wordpress blog posts

Someone recently asked me how we could set the Facebook featured image on our blog posts where there are no images. The featured image is used when you share a page on Facebook. It could be used, for example, on a post where you have an embedded video but no images.

I investigated various plugins which would set it by default for all posts, or you could set it in bulk, but nothing that allowed you to say "use this image on this post". I found another way to do it though. By adding style="display:none" just before the / > on the img tag you can hide an image from a post.

Various social plugins, such as Jetpack, will pick up on this and make it available to Facebook, or in technical terms, put open graph tags on it.