Created
September 26, 2017 09:25
-
-
Save webdados/ef5d5db01f01bee6041c2b2e0950d73a to your computer and use it in GitHub Desktop.
Using the fb_og_image_additional filter on Facebook Open Graph, Google+ and Twitter Card Tags for WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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