Missing description in FB Opengraph
-
Hi,
I’m editing Functions.php to generate FB Opengraph metatags, everything right till now but I can’t get the post description.
My code is:
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( get_the_ID() ), ‘medium’); $img_src = $img_src[0]; } else { $img_src = get_stylesheet_directory_uri() . '/img/opengraph_image.jpg'; } if($excerpt = $post->post_excerpt) { $excerpt = strip_tags($post->post_excerpt); $excerpt = str_replace("", "'", $excerpt); } else { $excerpt = get_bloginfo('description'); } ?>I’m obtaining an empty string in $excerpt
Any help would be appreciated.
Cheers
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
The topic ‘Missing description in FB Opengraph’ is closed to new replies.
