Create a gist now

Instantly share code, notes, and snippets.

Embed
Using the fb_og_image_additional filter on Facebook Open Graph, Google+ and Twitter Card Tags for WordPress
<?php
add_filter( 'fb_og_image_additional', 'extra_preview_images' );
function extra_preview_images( $fb_image_additional ) {
//You could/should use your own logic to decide which images to return. This example only shows you the structure of the array you should return.
if ( !is_array( $fb_image_additional ) ) {
$fb_image_additional = array();
}
$fb_image_additional[] = array(
'fb_image' => 'https://domain.com/wp-content/uploads/og_image2.jpg',
'png_overlay' => true, //Overlay PNG
);
$fb_image_additional[] = array(
'fb_image' => 'https://domain.com/wp-content/uploads/og_image3.jpg',
'png_overlay' => false, //Do not overlay PNG
);
return $fb_image_additional;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment