<?php
/**
* NOT WORKING PER https://theeventscalendar.com/support/forums/topic/schema-on-venues-pages/#post-1368859
*
* Events Calendar PRO: Add JSON-LD structured data (schema) markup to each
* event in the Single Venue's List View.
*
* If you want this do do the same for all List View implementations (both
* Events Archive and Single Venue), remove the 2 'venue' conditions in the
* conditional.
*
* @link https://gist.github.com/cliffordp/19978d19f9d8a0a589add5f841bd4ec1
* @link https://developers.google.com/search/docs/guides/intro-structured-data
*/
add_action( 'tribe_events_before_the_event_title', 'cliff_add_event_json_to_list_view_when_venue_single' );
function cliff_add_event_json_to_list_view_when_venue_single() {
global $wp_query;
// if rendering List View on single Venue page
if (
! empty( $wp_query->query_vars['eventDisplay'] )
&& 'list' == $wp_query->query_vars['eventDisplay']
&& ! empty( $wp_query->query_vars['venue'] )
&& tribe_is_venue( $wp_query->query_vars['venue'] )
) {
global $post;
Tribe__Events__JSON_LD__Event::instance()->markup( $post );
}
}