Skip to content

Instantly share code, notes, and snippets.

@jesseeproductions
Created January 21, 2016 16:46
Show Gist options
  • Save jesseeproductions/f022b8d8b4a9fa03de21 to your computer and use it in GitHub Desktop.
Save jesseeproductions/f022b8d8b4a9fa03de21 to your computer and use it in GitHub Desktop.
The Events Calendar 4.0.5 - Add Basic Offer for Events using Event Infomation
/**
* The Events Calendar 4.0.5 - Add Basic Offer for Events using Event Infomation
*/
add_filter( 'tribe_google_event_data', 'tribe_filter_google_markup', 10, 1 );
function tribe_filter_google_markup( $data ) {
$event_id = get_the_id();
$event_link = get_the_permalink();
$event_cost = get_post_meta ($event_id, '_EventCost', true );
$offer = (object) array(
'@type' => 'Offer',
'url' => $event_link,
'price' => $event_cost,
'category' => 'primary',
'availability' => 'inStock',
);
$data[$event_id]->{'offers'} = $offer;
return $data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment