Created
July 18, 2013 18:39
-
-
Save codearachnid/6031796 to your computer and use it in GitHub Desktop.
Add custom venue meta items by using the tribe_register_meta for individual items or tribe_register_meta_group for the group registration. See TEC (core plugin)/public/advanced-functions/meta.php for examples of group and individual registration
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
<?php | |
// add custom venue meta items | |
add_action('tribe_events_before_view','custom_venue_info'); | |
function custom_venue_info(){ | |
global $post; | |
// force this to run only on single event views | |
if( is_single() && tribe_is_event( $post->ID ) ){ | |
$room = get_post_meta( $post->ID, '_VenueRoom', true ); | |
tribe_register_meta( 'tribe_venue_room', array( | |
'label' => __( 'Room:', 'tribe-events-calendar' ), | |
'meta_value' => $room, | |
'group' => 'tribe_event_venue' | |
) ); | |
} | |
} | |
// add the new custom meta into the template keys for custom templates on single event views | |
add_action( 'tribe_events_single_event_meta_template_keys', 'custom_meta_keys'); | |
function custom_meta_keys( $keys ){ | |
$keys[] = 'tribe_venue_room'; | |
// any new meta items you create, add them here to be included in the template reset by single-event.php | |
return $keys; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment