This topic has 4 replies, 2 voices, and was last updated 6 years, 7 months ago ago by Rose Tyler
Hello,
I can’t find where I can change the og image in your theme.
When I test my page with FB debugger tool, I have the result enclosed. I tried to replace your facebook image default with one of mine by putting it in my child theme, but it doesn’t work. Or can I delete your facebook image default?
Thank you for your help.
Hello,
Please create folder ‘images’ in child-theme and upload your custom img,
then rewrite function et_insert_fb_in_head
in functions.php file of the child theme, the function you can find in main theme/framework/theme-functions.php
https://prnt.sc/jhlql5 – make changes as on screenshot and you will have your image on facebook share
Regards
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 "";
}
}
Hello,
We’ve sent you the screenshot of the code in the child theme, so check it one more time, please.
Regards
You must be logged in to reply to this topic.Log in/Sign up