Created
March 26, 2016 21:49
-
-
Save digitalinkwell/c767824d3ff5e7e40bd0 to your computer and use it in GitHub Desktop.
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
function fb_opengraph() { | |
global $post; | |
if(is_single()) { | |
if(has_post_thumbnail($post->ID)) { | |
$img_src = wp_get_attachment_image_src(get_post_thumbnail_id( $post->ID ), 'medium'); | |
} else { | |
$img_src = get_stylesheet_directory_uri() . 'url-to-your-image-here.jpg'; | |
} | |
if($excerpt = $post->post_excerpt) { | |
$excerpt = strip_tags($post->post_excerpt); | |
$excerpt = str_replace("", "'", $excerpt); | |
} else { | |
$excerpt = get_bloginfo('description'); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment