Skip to content

Instantly share code, notes, and snippets.

@barryhughes
Last active August 29, 2015 14:22
Show Gist options
  • Save barryhughes/ff8b9ed7d590091a1b6d to your computer and use it in GitHub Desktop.
Save barryhughes/ff8b9ed7d590091a1b6d to your computer and use it in GitHub Desktop.
/**
* 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