Created
January 3, 2013 15:46
-
-
Save bigdawggi/4444407 to your computer and use it in GitHub Desktop.
Super-simple fall-back open graph image for your WordPress blog. I didn't want/need a whole plugin for this, just wanted a simple og:image fall-back for my site.
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 this to your functions.php file | |
function mgr_og_image_fallback() { | |
if (!has_post_thumbnail()) { | |
// Replace the image URL unless you want my mug as your image for Open Graph Image ;) | |
?> | |
<meta property="og:image" content="http://i1.wp.com/matthewgrichmond.com/files/2012/03/matt.jpg?resize=310%2C180" /> | |
<?php | |
} | |
} | |
add_action('wp_head', 'mgr_og_image_fallback'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment