Hello,
Thank you but it doesn’t work. I don’t have the same as you. I have the following code:
if(!function_exists('et_insert_fb_in_head')) {
function et_insert_fb_in_head() {
global $post;
if ( !is_singular()) //if it is not a post or a page
return;
$description = et_excerpt( $post->post_content, $post->post_excerpt );
$description = strip_tags($description);
$description = str_replace("\"", "'", $description);
echo '<meta property="og:title" content="' . get_the_title() . '"/>';
echo '<meta property="og:type" content="article"/>';
echo '<meta property="og:description" content="' . $description . '"/>';
echo '<meta property="og:url" content="' . get_permalink() . '"/>';
echo '<meta property="og:site_name" content="'. get_bloginfo('name') .'"/>';
if(!has_post_thumbnail( $post->ID )) {
$default_image = PARENT_URL . '/images/staticks/facebook-default.jpg';
echo '<meta property="og:image" content="' . $default_image . '"/>';
} else {
$thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' );
echo '<meta property="og:image" content="' . esc_attr( $thumbnail_src[0] ) . '"/>';
}
echo "";
}
}