-
-
Save s4parke/75f03169f2ff429dd539 to your computer and use it in GitHub Desktop.
Add custom fields to a single event detail page
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_action('tribe_events_before_view','tribe_custom_fields_meta'); | |
function tribe_custom_fields_meta(){ | |
global $post; | |
// force this to run only on single event views | |
if( is_single() && tribe_is_event( $post->ID ) ){ | |
if( tribe_is_recurring_event( tribe_is_recurring_event( $post->ID ) ) ) { | |
tribe_register_meta( 'tribe_custom_fields_vaa', array( | |
'label' => 'Field one:', | |
'meta_value' => 'Value one', | |
'group' => 'tribe_event_details' | |
) ); | |
} | |
} | |
} | |
// 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_custom_fields_vaa'; | |
return $keys; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment