Home › Forums › Calendar Products › Events Calendar PRO › I want to display a custom field for venues on the single event page
- This topic has 3 replies, 2 voices, and was last updated 5 years, 11 months ago by ugapresents.
-
AuthorPosts
-
May 13, 2018 at 5:54 pm #1529334ugapresentsParticipant
Hi!
So I have added the field ‘Seating Chart’ to my venues via Advanced Custom Fields. It is a link type of field.
It displays correctly on my venue pages. However, I’d like to feature the seating chart link on single event pages as well.
The venue’s address, phone, website, etc. will display on the single event page….I just want to display the seating chart link too!
Below is the code that I have right now, which isn’t working yet :/
<?php /** * Single Event Meta (Venue) Template * * Override this template in your own theme by creating a file at: * [your-theme]/tribe-events/modules/meta/venue.php * * @package TribeEventsCalendar */ if ( ! tribe_get_venue_id() ) { return; } $term = get_queried_object(); $phone = tribe_get_phone(); $website = tribe_get_venue_website_link(); $seating = get_field('seating_chart', $term); ?> <div class="tribe-events-meta-group tribe-events-meta-group-venue"> <?php if ( ! empty( $seating ) ): ?> <div class="seating-chart"> <a href="<?php echo $seating['url']; ?>" class="red-link" >View Seating Chart</a> </div> <?php endif ?> <h3 class="tribe-events-single-section-title"> <?php esc_html_e( tribe_get_venue_label_singular(), 'the-events-calendar' ) ?> </h3> <dl> <?php do_action( 'tribe_events_single_meta_venue_section_start' ) ?> <dd class="tribe-venue"> <?php echo tribe_get_venue() ?> </dd> <?php if ( tribe_address_exists() ) : ?> <dd class="tribe-venue-location"> <address class="tribe-events-address"> <?php echo tribe_get_full_address(); ?> <?php if ( tribe_show_google_map_link() ) : ?> <?php echo tribe_get_map_link_html(); ?> <?php endif; ?> </address> </dd> <?php endif; ?> <?php if ( ! empty( $phone ) ): ?> <dt> <?php esc_html_e( 'Phone:', 'the-events-calendar' ) ?> </dt> <dd class="tribe-venue-tel"> <?php echo $phone ?> </dd> <?php endif ?> <?php if ( ! empty( $website ) ): ?> <dt> <?php esc_html_e( 'Website:', 'the-events-calendar' ) ?> </dt> <dd class="url"> <?php echo $website ?> </dd> <?php endif ?> <?php do_action( 'tribe_events_single_meta_venue_section_end' ) ?> </dl> </div>
May 14, 2018 at 7:56 am #1529704VictorKeymasterHi Blake!
Thanks for getting in touch with us!
First, please let me note that we are fairly limited in how much support we can give for custom development questions like that.
That said, we always like helping out and at least point users into the right direction as much possible.
The get_field function requires the post_id to be passed as an argument, so try using the get_field like the following:
$seating = get_field( 'seating_chart', tribe_get_venue_id() );
I hope that helps.
Best,
VictorMay 15, 2018 at 9:04 am #1530817ugapresentsParticipantThat worked perfectly! Thanks.
May 15, 2018 at 2:01 pm #1531196VictorKeymasterGlad to be of help 🙂
I’ll close this thread now, but feel free to open a new topic if anything comes up and we’ll be happy to help.
Cheers,
Victor -
AuthorPosts
- The topic ‘I want to display a custom field for venues on the single event page’ is closed to new replies.