Okay
  Public Ticket #2658054
Featured image
Closed

Comments

  •  5
    Earl D started the conversation

    is there a way to set any of the images added to an event as a featured image so it is shown when shared to twitter etc?

  •  877
    Zhivko replied

    That's the default behaviour for facebook share button.

    For twitter add this function in your theme or child-theme functions.php file:

    add_filter('stec_get_event_og', function($og, $event, $offset) {
        $image = '';
        if ($event->get_images()) {
            $images = $event->get_parsed_images();
            $image  = $images[0]->src;
        }
        return array_merge($og, array(
            'twitter:card'        => 'summary_large_image',
            'twitter:title'       => $event->get_title(),
            'twitter:description' => $event->get_description_short(),
            'twitter:image'       => $image,
        ));
    }, 10, 3);
    

    I'll include the twitter og data in the next update.


    Stachethemes Developer

  •  5
    Earl D replied

    Thanks appreciate the response.