Here is a bit of code to help those trying to automate the specifying of images to be shown when being linked to by Facebook.
The logic is
1. If there’s a featured image, get the url of the thumbnail.
2. If not, get the url of the thumbnail of the first image in the post (by attachment relationship, meaning it has to be uploaded while editing that post.
3. If still nothing, get a specified image from the theme directory.
This creates a function to place in your functions.php file.
Feel free to improve this and comment.
- The topic ‘Control facebook image references based o thumbnails etc.’ is closed to new replies.