We're merging with GenerateBlocks! Learn more here.

Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Changing image and excerpt source to use meta for some lists Reply To: Changing image and excerpt source to use meta for some lists

#11250
Tom
Keymaster

That actually makes it easier:

add_action( 'wpsp_before_header', function() {
    if ( ! has_post_thumbnail() && get_post_meta( get_the_ID(), '_yoast_wpseo_opengraph-image', true ) ) {
        printf(
            '<div class="wp-show-posts-image">
                <a href="%1$s">
                    <img src="%2$s" alt="" />
                </a>
             </div>',
             get_permalink(),
             get_post_meta( get_the_ID(), '_yoast_wpseo_opengraph-image', true )
        );
    }
} );

Let me know 🙂