Last active
August 29, 2015 14:22
-
-
Save barryhughes/ff8b9ed7d590091a1b6d to your computer and use it in GitHub Desktop.
This file contains 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
/** | |
* Outputs all WP post meta fields (except those prefixed "_"), feel | |
* free to tweak the formatting! | |
*/ | |
function show_wp_custom_fields() { | |
foreach ( get_post_meta( get_the_ID() ) as $field => $value ) { | |
$field = trim( $field ); | |
if ( is_array( $value ) ) $value = implode( ', ', $value ); | |
if ( 0 === strpos( $field, '_' ) ) continue; // Don't expose "private" fields | |
echo '<strong>' . esc_html( $field ) . '</strong> ' . esc_html( $value ) . '<br/>'; | |
} | |
} | |
// Hooks the above function up so it runs in the single organizer and venue pages | |
add_action( 'tribe_events_single_organizer_before_upcoming_events', 'show_wp_custom_fields' ); | |
add_action( 'tribe_events_single_venue_before_upcoming_events', 'show_wp_custom_fields' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment