• Resolved Andyt8

    (@andyt8)


    Hello,

    I started using your nice plugin, but found a problem. I refer to Open Graph Integrator. I enabled it and after reloading, I see different meta entries like “og:”.

    However, I’m missing “og:image”, so I tried to enable a default image and after reloading it will be shown on every article. It looks a little bit strange, because the most article have several pictures. How do your plugin check for article picture?

    Before starting with SEO plugin, I used some code in my header.php for Open Graph like
    >>>
    <?php if (is_single()) { ?>
    <meta property=”og:locale” content=”de_DE”/>
    <meta property=”og:type” content=”article” />
    <meta property=”og:title” content=”<?php single_post_title(”); ?>” />
    <meta property=”og:image” content=”<?php if (function_exists(‘catch_that_image’)) {echo catch_that_image(); }?>” />
    <meta property=”og:site_name” content=”<?php bloginfo(‘name’); ?>”/>
    <?php }
    <<<

    With that, I see for every article the correct image. Is something wrong with my blog: http://blog.blackseals.net or is there a bug with your plugin (and new WP version)?

    Please for help.

    regards, Andyt

    https://wordpress.org/plugins/seo-ultimate/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jeffrey L. Smith

    (@seo-design-solutions)

    Hi:

    If you have other OG plugin or code, you should only defer to one and turn the others off (including Jetpack).

    Also, right now when checking in SEO Ultimate in the source code of your site I do see this…

    <meta property="og:image" content="http://blackseals.net/features/blackseals.png" />

    So, the image is there and it validates – http://screencast.com/t/xmc4nGyGBJR so, how is this a problem?

    Best,

    Jeffrey

    Thread Starter Andyt8

    (@andyt8)

    Hello,

    Thank you for your fast response. I have no further OG plugin. I already know, two or more of them isn’t a good decision.

    However, if you look to article http://blog.blackseals.net/2015/12/09/wordpress-4-4-ist-da/ and to the source code, then you will find

    <meta property="og:image" content="http://blackseals.net/features/bs_blog.png" />

    This is the default image. If I disable the default image, no image is included. My problem, the article have two pictures and my question, why no one of that is used for og:image?

    regards,
    Andyt

    Thread Starter Andyt8

    (@andyt8)

    Some further information about <meta property=”og:image” content=”<?php if (function_exists(‘catch_that_image’)) {echo catch_that_image(); }?>” /> – special the used function catch_that_image:

    It is or was something extra in function.php …

    function catch_that_image() {
      		global $post, $posts;
      		$first_img = '';
      		ob_start();
      		ob_end_clean();
      		$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
      		$first_img = $matches [1] [0];
    
      		if(empty($first_img)){ //Defines a default image
      			$first_img = bloginfo('template_directory');
        		$first_img .= "http://blackseals.net/features/bs_blog.png";
      		}
      		return $first_img;
    	}

    I got the first image for og:image. However, your plugin have Open Graph integrated with many more options. So it seems to me, to be a better way for Open Graph. However, my posts have images, but no og:image is found, execpt of default.

    Is this something wrong with WordPress or my theme? Maybe I understand the og:image in a wrong way? Please for answer.

    regards, Andyt

    Thread Starter Andyt8

    (@andyt8)

    I found a solution for me. Your plugin only looks for featured image and according to my usage of Windows Live Writer or now Open Live Writer, there is no featured image.

    I found the following:

    function auto_featured_image() {
        global $post;
    
        if (!has_post_thumbnail($post->ID)) {
            $attached_image = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" );
    
          if ($attached_image) {
                  foreach ($attached_image as $attachment_id => $attachment) {
                       set_post_thumbnail($post->ID, $attachment_id);
                  }
             }
        }
    }
    // Use it temporary to generate all featured images
    add_action('the_post', 'auto_featured_image');
    // Used for new posts
    add_action('save_post', 'auto_featured_image');
    add_action('draft_to_publish', 'auto_featured_image');
    add_action('new_to_publish', 'auto_featured_image');
    add_action('pending_to_publish', 'auto_featured_image');
    add_action('future_to_publish', 'auto_featured_image');

    With that, I was able to generate featured image for a post and now your plugin found this one.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Open Graph Image is wrong or missing’ is closed to new replies.