Help with coding: multiple organizers, show all phone & emails on single-event

Home Forums Calendar Products Events Calendar PRO Help with coding: multiple organizers, show all phone & emails on single-event

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1214317
    Shawn
    Participant

    I’d like to have multiple organizers show their phone and emails without visitors having to click on the organizer (see the attached photo). I’m not an expert in .php and i’d like to see if anyone can help me out. When I tried it myself it showed only the first organizer info under both names.
    Here is me current Single Event Code

    <?php
    /**
     * Single Event Template
     * A single event. This displays the event title, description, meta, and
     * optionally, the Google map for the event.
     *
     * Override this template in your own theme by creating a file at [your-theme]/tribe-events/single-event.php
     *
     * @package TribeEventsCalendar
     * @version  4.3
     *
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
    	die( '-1' );
    }
    
    $events_label_singular = tribe_get_event_label_singular();
    $events_label_plural = tribe_get_event_label_plural();
    
    $event_id = get_the_ID();
    
    // Setup an array of venue details for use later in the template
    $venue_details = tribe_get_venue_details();
    
    // Venue
    $has_venue_address = ( ! empty( $venue_details['address'] ) ) ? ' location' : '';
    
    // Organizer
    $organizer = tribe_get_organizer();
    
    $organizer_ids = tribe_get_organizer_ids();
    $multiple = count( $organizer_ids ) > 1;
    
    $phone = tribe_get_organizer_phone();
    $email = tribe_get_organizer_email();
    $website = tribe_get_organizer_website_link();
    
    ?>
    
    <div id="tribe-events-content" class="tribe-events-single">
    
    	<p class="tribe-events-back">
    		<a href="<?php echo esc_url( tribe_get_events_link() ); ?>"> <?php printf( '&laquo; ' . esc_html_x( 'All %s', '%s Events plural label', 'the-events-calendar' ), $events_label_plural ); ?></a>
    	</p>
    
    	<!-- Notices -->
    	<?php tribe_the_notices() ?>
    
    	<?php the_title( '<h1 class="tribe-events-single-event-title">', '</h1>' ); ?>
    
    	<div class="tribe-events-schedule tribe-clearfix">
    		<?php echo tribe_events_event_schedule_details( $event_id, '<h2>', '</h2>' ); ?>
    		<?php if ( tribe_get_cost() ) : ?>
    			<span class="tribe-events-cost"><?php echo tribe_get_cost( null, true ) ?></span>
    		<?php endif; ?>
    	</div>
    	<!-- Event header -->
    	<div id="tribe-events-header" <?php tribe_events_the_header_attributes() ?>>
    	</div>
    	<!-- #tribe-events-header -->
    	<?php if ( $venue_details ) : ?>
    			<!-- Venue Display Info -->
    			<div style="width:40%;padding:0 10px 0 0;float:left;" class="tribe-events-venue-details">
    			<dt> <?php esc_html_e( 'Auction will be held at:', 'the-events-calendar' ) ?> </dt>
    				<?php echo implode( ', ', $venue_details ); ?>
    				<?php
    				if ( tribe_get_map_link() ) {
    					echo tribe_get_map_link_html();
    				}
    				?>
    			</div> <!-- .tribe-events-venue-details -->
    	<?php endif; ?>
    <!-- Organizer Display -->
    
    <div style="width:60%;padding:0 10px 0 0;float:right;" class="tribe-events-meta-group tribe-events-meta-group-organizer">
    	<dt class="tribe-events-venue-details"><?php esc_html_e( 'Auction Contact:', 'the-events-calendar' ) ?> </dt>
    	<dl>
    		<?php
    		do_action( 'tribe_events_single_meta_organizer_section_start' );
    
    		foreach ( $organizer_ids as $organizer ) {
    			if ( ! $organizer ) {
    				continue;
    			}
    			?>
    			<dt style="display:none;"><?php // This element is just to make sure we have a valid HTML ?></dt>
    			<dd class="tribe-organizer">
    				<?php echo tribe_get_organizer_link( $organizer ) ?>
    			</dd>
    			<?php
    		}
    		if ( ! $multiple ) { // only show organizer details if there is one
    			if ( ! empty( $phone ) ) {
    				?>
    				<?php esc_html_e( 'Phone:', 'the-events-calendar' ) ?>
    				<?php echo esc_html( $phone ); ?>
    				<?php
    			}//end if
    			if ( ! empty( $email ) ) {
    				?>
    				<?php esc_html_e( ', Email:', 'the-events-calendar' ) ?>
    					<?php echo esc_html( $email ); ?>
    				<?php
    			}//end if
    		}//end if
    
    		do_action( 'tribe_events_single_meta_organizer_section_end' );
    		?>
    	</dl>
    </div>
    <div style="clear:both;"></div>
    <!-- End Organizer Display -->
    	<?php while ( have_posts() ) :  the_post(); ?>
    		<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    			<!-- Event content -->
    			<?php do_action( 'tribe_events_single_event_before_the_content' ) ?>
    			<div class="tribe-events-single-event-description tribe-events-content">
    				<?php the_content(); ?>
    			</div>
    			<!-- .tribe-events-single-event-description -->
    			<?php do_action( 'tribe_events_single_event_after_the_content' ) ?>
    
    			<!-- Event meta -->
    			<?php do_action( 'tribe_events_single_event_before_the_meta' ) ?>
    			<?php tribe_get_template_part( 'modules/meta' ); ?>
    			<?php do_action( 'tribe_events_single_event_after_the_meta' ) ?>
    		</div> <!-- #post-x -->
    		<?php if ( get_post_type() == Tribe__Events__Main::POSTTYPE && tribe_get_option( 'showComments', false ) ) comments_template() ?>
    	<?php endwhile; ?>
    
    	<!-- Event footer -->
    	<div id="tribe-events-footer">
    		<!-- Navigation -->
    		<h3 class="tribe-events-visuallyhidden"><?php printf( esc_html__( '%s Navigation', 'the-events-calendar' ), $events_label_singular ); ?></h3>
    		<ul class="tribe-events-sub-nav">
    			<li class="tribe-events-nav-previous"><?php tribe_the_prev_event_link( '<span>&laquo;</span> %title%' ) ?></li>
    			<li class="tribe-events-nav-next"><?php tribe_the_next_event_link( '%title% <span>&raquo;</span>' ) ?></li>
    		</ul>
    		<!-- .tribe-events-sub-nav -->
    	</div>
    	<!-- #tribe-events-footer -->
    
    </div><!-- #tribe-events-content -->
    • This topic was modified 7 years, 2 months ago by Shawn.
    #1215388
    Nico
    Member

    Hi there Shawn!

    Thanks for getting in touch with us! I can help you here ๐Ÿ™‚

    Checkout the code below (a modified version of the default template for organizers display โ†’ /tribe-events/modules/meta/organizer.php) and adapt it to your customized code for this part.

    https://gist.github.com/niconerd/3a65b22cb4820e63872aba20f99c3255

    Please take a look and let me know if you can make it work for your site,
    Best,
    Nico

    #1215823
    Shawn
    Participant

    Perfect, that’s what I needed. Thank you for the help!

    #1215961
    Nico
    Member

    Perfect! Thanks for confirming Shawn ๐Ÿ™‚

    Iโ€™ll go ahead and close out this thread, but if you need help with anything else please donโ€™t hesitate to create a new one and we will be happy to assist you.

    Best,
    Nico

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Help with coding: multiple organizers, show all phone & emails on single-event’ is closed to new replies.