Okay
  Print

How to Add Event Images to Yoast SEO in Stachethemes Event Calendar Version 5

To tell Yoast Seo to use the event image for it's og:image meta place the following hook in your child-theme functions.php file:

/**
 * OG:Image filter for Yoast SEO plugin
 * Adds first image from event to Yoast SEO Open Graph Image
 * Works only for single event pages
 */
add_filter('wpseo_add_opengraph_images', function ($image_container) {     if (get_post_type() === 'stec_event') {         $images = get_post_meta(get_the_ID(), 'images');
        if (is_array($images) && $images) {
            $image = array_shift($images);
            $image_container->add_image_by_id( $image['id'] );
        }     }     return $image_container; });