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.