Shoora
10/11/2018 - 6:02 PM

Add JSON-LD structured data to list view

Add JSON-LD structured data to list view

<?php
/**
 * Description: Add JSON-LD structured data to list view
 *
 * Usage: copy the snippet in your active (child) theme's functions.php file
 *
 * Plugins: The Events Calendar
 * Author: Modern Tribe
 * Last updated: September 7, 2018
 */
function tribe_list_view_structured_data ( ) {
  
    // bail if not list view
    if ( ! tribe_is_list_view() ) return;
  
    global $wp_query;
  
    Tribe__Events__JSON_LD__Event::instance()->markup( $wp_query->posts );
}
add_action( 'wp_head', 'tribe_list_view_structured_data' );