WordPress.org

Support

Support » Miscellaneous » Control facebook image references based o thumbnails etc.

Control facebook image references based o thumbnails etc.

  • 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.

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Feel free to improve this and comment.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Control facebook image references based o thumbnails etc.’ is closed to new replies.
Skip to toolbar