• Is there a way to add the event date to the meta title for SEO? All recurring events have the same title tag and this is throwing errors in our SEO scanning software. Adding the event date to the page title will allow each individual event to have it’s own custom title.

Viewing 1 replies (of 1 total)
  • Thread Starter dadadmin

    (@dadadmin)

    Update: I was able to create a custom variable for Yoast SEO that would pull in the date anywhere. Now my other issue is that the %%excerpt%% is not reading what I have in the Event Excerpt options “EVENTDATES – #_EVENTEXCERPT” and yes, Override Excerpts with Formats?? is enabled in my settings.

    // Create Yoast variable for Event Start Date.
    function yoast_var1( $var1 ) {
    global $EM_Event, $wp_query;
    $date_format = get_option('dbem_date_format'); // This will use the date fotmatting in your EM setttings.
    $start_date = get_post_meta(get_the_ID(), '_event_start_date', true);
    $result = date_i18n($date_format, strtotime($start_date));
    return $result;
    }
    
    // Define which variable to use in the Yoast snippet box.
    function create_yoast_variables_for_em() {
    wpseo_register_var_replacement('%%event_date%%', 'yoast_var1', 'basic');
    
    }
    add_action('wpseo_register_extra_replacements', 'create_yoast_variables_for_em');

Viewing 1 replies (of 1 total)
  • The topic ‘Event Date in SEO Page Title’ is closed to new replies.