Facebook Head - by gurhan - on WordPress WooCommerce support

This topic has 20 replies, 2 voices, and was last updated 6 years, 4 months ago ago by Rose Tyler

  • Avatar: gurhan
    gurhan
    Participant
    May 12, 2018 at 19:30

    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!

    19 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 14, 2018 at 08:06

    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

    Avatar: gurhan
    gurhan
    Participant
    May 14, 2018 at 09:56

    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

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 14, 2018 at 10:24
    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

    Avatar: gurhan
    gurhan
    Participant
    May 14, 2018 at 12:30

    works!!!!

    thank you!!!!

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 14, 2018 at 12:31

    You’re welcome!

    Regards

    Avatar: gurhan
    gurhan
    Participant
    June 27, 2018 at 12:32

    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 "";
    }
    
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 27, 2018 at 12:58

    Hello,

    Please provide temporary wp-admin and FTP access in the Private Content area so we can take a closer look.

    Regards

    Avatar: gurhan
    gurhan
    Participant
    June 27, 2018 at 13:58

    here you go…

    Please, contact administrator
    for this information.
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 27, 2018 at 14:04

    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

    Avatar: gurhan
    gurhan
    Participant
    June 27, 2018 at 14:29

    please try again

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 27, 2018 at 14:41

    Have you changed credentials?
    Response: 530 Login authentication failed
    Error: Critical error: Could not connect to server

    Regards

    Avatar: gurhan
    gurhan
    Participant
    June 27, 2018 at 14:45

    no, we didn’t….

    i gave it to you again…

    Please, contact administrator
    for this information.
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 27, 2018 at 15:30

    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

    Avatar: gurhan
    gurhan
    Participant
    June 27, 2018 at 15:32

    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.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 27, 2018 at 15:43

    We’ve cleaned FB cache – https://prnt.sc/k00c7f https://developers.facebook.com/tools/debug/ Please check now.

    Regards

    Avatar: gurhan
    gurhan
    Participant
    June 27, 2018 at 15:53

    how do you clean the FB cache, please?

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 27, 2018 at 15:55

    Here is link https://developers.facebook.com/tools/debug/ – add your page URL and click on this button https://prnt.sc/k00c7f

    Regards

    Avatar: gurhan
    gurhan
    Participant
    June 27, 2018 at 16:24

    awesome… TU Rose!

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 29, 2018 at 07:52

    You’re welcome!

    Regards

  • Viewing 20 results - 1 through 20 (of 20 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.