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');