Forked from barryhughes/single-org-venue-post-meta.php
Last active
August 29, 2015 14:22
-
-
Save theeventscalendar/4c042e8da31ee33e684c to your computer and use it in GitHub Desktop.
Allows WP Custom Fields to show on the front end of Venue and Organizer pages
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
| /** | |
| * 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