Okay
  Public Ticket #3810446
SEO: Add meta description to event
Open

Comments

  •  2
    rosewich started the conversation

    Could you add a way to supply a meta description to each event? We think it's not possible to use existing SEO plugins for this as they do not see the events post type. 

  •  901
    Zhivko replied

    Hi,

    The plugin automatically places the event short description as og:description

    If you want to modify something in the og you can check out the file /includes/posts/class.post-stec_event.php line 27.

    There is a filter that you can use to override the default og meta.

    Example:

    add_filter('stec_single_og', function ($og, $post_id) {
       
        $og_meta = '
            <meta property="og:title" content="' . esc_attr(get_the_title($post_id)) . '" />
            <meta property="og:description" content="' . esc_attr(get_the_excerpt($post_id)) . '" />
            <meta property="og:url" content="' . esc_url(get_permalink($post_id)) . '" />
            <meta property="og:image" content="' . esc_url(get_the_post_thumbnail_url($post_id, 'full')) . '" />
            <meta property="og:type" content="website" />
        ';
    
        return $og_meta;
    }, 10, 2);

    If Yoast SEO is enabled the plugin will use teh Yoast SEO og meta instead.

     

     


    Stachethemes Developer