This topic has 20 replies, 2 voices, and was last updated 6 years, 4 months ago ago by Rose Tyler
I tried following this link: https://www.8theme.com/topic/og-image/#post-190644
But as the other person indicated, the “et_insert_fb_in_head” function is different than the one you show in the screenshot.
So,
1. I created a new image
2. I created “images” directory in the child theme
3. I uploaded the image into that directory
But “et_insert_fb_in_head” function in “theme-functions.php” is not same as you indicate.
How do we resolve this issue, please?
Thank you!
Hello,
Here is a screenshot from parent theme file http://prntscr.com/jhjytc, copy this code to child theme (functions.php file) and change to https://prnt.sc/jhlql5
Let me know result.
Regards
can you just paste the modified code here, so I can copy and paste it to the child theme.
when i did it, this is what I got: https://prnt.sc/jhlb0u
function et_insert_fb_in_head() {
global $post;
$og_tags = etheme_get_option('disable_og_tags');
if ( !is_singular() || $og_tags[0] == 1) //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 = get_stylesheet_directory_uri() . '/images/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 "";
}
Regards
works!!!!
thank you!!!!
You’re welcome!
Regards
I need to open this subject again…
1. Child Theme is active
2. The name of the image is “facebook-custom.jpg”
3. it is in the “images” directory in the child-theme
4. below code is in the functions.php of the child-theme
5. That head is still showing in the Facebook
6. What am I doing wrong?
function et_insert_fb_in_head() {
global $post;
$og_tags = etheme_get_option('disable_og_tags');
if ( !is_singular() || $og_tags[0] == 1) //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 = get_stylesheet_directory_uri() . '/images/facebook-custom.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,
Please provide temporary wp-admin and FTP access in the Private Content area so we can take a closer look.
Regards
here you go…
We have tried FTP access to connect to your server and seems you give access to empty directory https://prnt.sc/jzyvqj We need access to your WP installation.
Regards
please try again
Have you changed credentials?
Response: 530 Login authentication failed
Error: Critical error: Could not connect to server
Regards
no, we didn’t….
i gave it to you again…
Hello,
We’ve checked your site and do not see the problem – https://prnt.sc/k004zt
Please explain in details what exactly is not correct.
Regards
if you go to Facebook and put the site’s URL, you still see that head, not the image that we uploaded to the “images” directory.
We’ve cleaned FB cache – https://prnt.sc/k00c7f https://developers.facebook.com/tools/debug/ Please check now.
Regards
how do you clean the FB cache, please?
Here is link https://developers.facebook.com/tools/debug/ – add your page URL and click on this button https://prnt.sc/k00c7f
Regards
awesome… TU Rose!
You’re welcome!
Regards
You must be logged in to reply to this topic.Log in/Sign up