The Yoast WordPress SEO plugin firstly looks the og:image by looking for:
Looks for a featured image
If there isn’t a featured image, it looks for the first image within the_content
If there isn’t a featured image or any image within the_contentthen use a default image
My site does not use any of these, so the image defaults back to default image.
Here Yoast explains how he created the code, can anyone help me apply it to my custom images?
I use magic fields for custom post types and this is the code I use to get the image:
<img src=”<?php echo get_image (‘shoe_image’, 1 , 1 , 0 ) ?>” title=”<?php echo get(‘shoe_image_title_tag’); ?>” alt=”<?php echo get(‘shoe_image_alt_tag’); ?>” itemprop=”image” />
Thanks a lot!
- The topic ‘Help with Custom Posts and og:image please!’ is closed to new replies.