Created
August 17, 2013 18:34
-
-
Save jeherve/6258174 to your computer and use it in GitHub Desktop.
[Jetpack] Add a default Image Open Graph tag only on the home page (because Jetpack doesn’t add an image tag on the home page)
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 | |
function fb_home_image() { | |
$fb_home_img = 'YOUR_IMAGE_URL'; | |
$fb_home_img_output = sprintf( '<meta property="og:image" content="%s" />', esc_attr( $fb_home_img ) ); | |
if ( is_home() ) | |
echo $fb_home_img_output; | |
} | |
add_action( 'wp_head', 'fb_home_image' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment