[Plugin Yoast WordPress SEO] Custom Posts and og:image (1 post)

  1. Siegoboy
    Posted 3 years ago #

    The Yoast WordPress SEO plugin firstly looks the og:image by looking for:

    1. Looks for a featured image
    2. If there isn’t a featured image, it looks for the first image within the_content
    3. 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!

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.