Event Cost not displaying

Home Forums Ticket Products Eventbrite Tickets Event Cost not displaying

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1610059
    leviticus
    Participant

    I created a php snippet to display a list of events, but the event cost isn’t showing up. Here’s my code:

    <?php
    
    $query = new WP_Query( array(
    	'post_type' => 'tribe_events' ,
    	'post_status'=>'publish',
      	'post_type'=>array(TribeEvents::POSTTYPE),
    	//order by startdate from newest to oldest
      	'meta_key'=>'_EventStartDate',
      	'orderby'=>'_EventStartDate',
     	'order'=>'ASC',
     	'eventDisplay'=>'custom',
    	'posts_per_page' => -1 ,
    	'tribe_events_cat' => 'fall-winter-spring',
    
     ) );
    
    if ($query->have_posts())
    {
    	while ($query->have_posts()) : $query->the_post(); ?>
    <div class="flex_column av_one_fourth first  avia-builder-el-1  el_after_av_textblock  el_before_av_three_fourth">
    
        <div class="avia-image-container  av-styling-  avia-builder-el-2  avia-builder-el-no-sibling  avia-align-center " itemscope="itemscope" itemtype="https://schema.org/ImageObject">
        
            <div class="avia-image-container-inner">
            <?php echo tribe_event_featured_image(null, 'square') ?>	        
            </div>
        
        </div>
    
    </div>
    
    <div class="flex_column av_three_fourth   avia-builder-el-3  el_after_av_one_fourth  el_before_av_hr">
        <section class="av_textblock_section" itemscope="itemscope" itemtype="https://schema.org/CreativeWork">
            <div class="avia_textblock " itemprop="text">
    			<?php do_action( 'tribe_events_list_widget_before_the_event_title' ); ?>
               	<h2 class="event-title"><a href="<?php echo tribe_get_event_link(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    			<?php do_action( 'tribe_events_list_widget_after_the_event_title' ); ?>
        
                <?php do_action( 'tribe_events_list_widget_before_the_meta' ) ?>
        
                <div class="duration">
                    <h4><?php echo tribe_events_event_schedule_details(); ?></h4>
                </div>
                
            <div class="event-excerpt">
    			<?php echo tribe_events_get_the_excerpt() ?>
            </div>
    
                <?php if ( tribe_get_cost() ) : ?>
    	<div class="tribe-events-event-cost">
    		Cost: <span class="ticket-cost"><?php echo tribe_get_cost( null, true ); ?></span>
    		<?php
    		/**
    		 * Runs after cost is displayed in list style views
    		 *
    		 * @since 4.5
    		 */
    		do_action( 'tribe_events_inside_cost' )
    		?>
    	</div>
    <?php endif; ?>
    			
    			<div class="grades">
                    <?php ob_start();
    tribe_get_template_part( 'pro/modules/meta/additional-fields', null, array(
        'fields' => tribe_get_custom_fields(),
    ) );
     
    $html = ob_get_clean();?>
                    <strong><?php echo $html; ?></strong>
                </div>
    
    		<?php do_action( 'tribe_events_list_widget_after_the_meta' ) ?>
            </div>
        </section>
    </div>
    <div class="hr hr-default  avia-builder-el-10"><span class="hr-inner "><span class="hr-inner-style"></span></span></div>
    <?php
    	endwhile;
    } 
    wp_reset_query();?>

    Any thoughts as to why it is not showing up? The events are entered with the correct price and that shows up on the their respective single event page.

    #1612377
    Sky
    Keymaster

    Hi there,

    Thanks for reaching out. Please note that we are limited in how much support we can provide for customizations such as this. That being said, I will try to help if I can.

    Eventbrite data gets stored a little differently than normal events. There is a “cost” field available on events that gets hidden when using any of the premium tickets plugins. I believe this is the field that your code is checking for here.

    We do have a free extension that allows this field to show when using Eventbrite. You can check that out here: https://theeventscalendar.com/extensions/show-cost-field/.

    Try activating that plugin, add a value in the event, and see if that will show the information in your template as expected.

    Hope that helps!

    Thanks,
    Sky

    #1615160
    leviticus
    Participant

    I’m not using Event Tickets or Eventbrite Tickets. Would my issue still be related to those plugins even if they aren’t installed? If not, any other thoughts as to why the cost isn’t pulling in?

    #1615207
    leviticus
    Participant

    I’ve also noticed that my custom fields are also not showing up.

    <div class="grades">
                    <?php ob_start();
    tribe_get_template_part( 'pro/modules/meta/additional-fields', null, array(
        'fields' => tribe_get_custom_fields(),
    ) );
     
    $html = ob_get_clean();?>
                    <strong><?php echo $html; ?></strong>
                </div>
    #1615287
    leviticus
    Participant

    Ok. Fresh set of eyes found the problem. It was a weird styling issue.

    Sorry to waste your time!

    #1615296
    Sky
    Keymaster

    Hi again,

    Awesome! Glad to hear you were able to get it resolved.

    Please let us know if you have any questions or issues in the future.

    Thanks,
    Sky

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Event Cost not displaying’ is closed to new replies.