Created
January 21, 2016 16:46
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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