Template tags to display ticket purchase options?

Home Forums Ticket Products Event Tickets Plus Template tags to display ticket purchase options?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1089355
    Roberta
    Participant

    I’d like to display the Add to Cart table within the loop but outside of the Single view. Currently, it only shows if I click into a event. I’m outputting the_content() but I don’t see the ticket purchase table, so I imagine it’s an additional tag I need to place in my template file so this will show up?

    #1089363
    Roberta
    Participant

    Oh, I am using WooCommerce to sell the tickets.

    #1089956
    Nico
    Member

    Hi Roberta,

    Thanks for reaching out to us. Interesting question I can help you with it!

    To add the tickets form to the events listings (list, day & photo view), go ahead and add this snippet to your theme’s (or child theme) functions.php:

    https://gist.github.com/niconerd/0db0311594ddcfc8fa9e

    Please give it a try and let me know,
    Best,
    Nico

    #1090014
    Roberta
    Participant

    Ah, so close! This is actually a custom loop I’m running for a page dedicated to the Live Music category. Is it possible to display the form within a custom query such as this:

    <?php if(is_page(7)) { // if a Live Music page
    
    // events loop
    
      $args = array(
        "post_type" => 'tribe_events',
        "eventDisplay" => 'upcoming',
        'tax_query' => array(
          array(
            'taxonomy' => 'tribe_events_cat',
            'field' => 'slug',
            'terms' => 'live-music'
            )
          ),
        "posts_per_page" => '-1',
        "start_date" => date('Y-m-d H:i:s', strtotime("now")),
        'orderby' => 'event_date',
        'order' => 'ASC'
        );
    
      $events = new WP_query($args);
    
      while($events->have_posts()): $events->the_post(); ?>
      <div class="event-listing">
        <h2  class="event-des"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
        <div class="event-content">
          <?php the_content(); ?>
        </div>
      <p><a href="<?php the_permalink();?>" class="button">View Event Details and Purchase Tickets</a></p>
      </div>
    <?php endwhile; ?>
    <?php wp_reset_query(); ?>
    <?php } //endif is_page for Live Music ?>
    #1090304
    Nico
    Member

    Thanks for following up Roberta!

    You can actually fire an action from this code as well. Just add this line after the_content():

    do_action('custom_tickets_placement');

    And update the snippet to this:

    https://gist.github.com/niconerd/0db0311594ddcfc8fa9e

    Please let me know if that solves the issue,
    Best,
    Nico

    #1090410
    Roberta
    Participant

    SO simple! Awesome, thank you!

    #1090451
    Nico
    Member

    Glad to be of service!

    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 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Template tags to display ticket purchase options?’ is closed to new replies.