Created
March 14, 2019 17:19
-
-
Save DigitalEssence/988dcc6b34bd25fe424a712e54065992 to your computer and use it in GitHub Desktop.
WordPress - PHP - Add og Open Graph data to header
This file contains hidden or 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
//Add Open Graph | |
add_action('wp_head', 'fb_opengraph'); | |
function fb_opengraph() { | |
if( is_single() || is_page() ) { | |
echo ' | |
<meta property="og:title" content="Osso Restaurant - Peebles" /> | |
<meta property="og:description" content="Osso Restaurant Peebles - Michelin Bib Gourmand Winner 2011 to 2018" /> | |
<meta property="og:image" content="https://www.ossorestaurant.com/wp-content/uploads/2019/03/facebook-og-image.jpg" />'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment