Adding a book now button to photo view

Home Forums Calendar Products Events Calendar PRO Adding a book now button to photo view

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1352485
    Sarah Lewis-Hammond
    Participant

    Hello! Is it possible to add a book now button for each event in the photo view, which will put the event ticket in the cart and take the user to the view cart page? Thx.

    #1352799
    Geoff B.
    Member

    Good afternoon Sarah and welcome back!

    Thank you for reaching out to us.
    I would love to help you with this topic.

    There are 2 ways to go about this:

    1. You could apply the following snippet in the functions.php file of your theme (without the PHP tag at the top): https://gist.github.com/elimn/565e4768163f72fbcea0402ea9636e2d#file-tribe_events_output_cta-php

      Make sure you adapt this snippet for photo view as it is meant for list view.

    2. Create a custom photo view template. You can literally steal the code from the list view (in the list view template – which contains such a button by default now) and add it to your custom photo view template.

      You might want to read our Themer’s guide to get a sense of how that works.

    Let me know if that helps.

    Have a great day!

    Geoff B.

    #1354497
    Sarah Lewis-Hammond
    Participant

    Hiya

    Thanks for your reply.

    I tried 1 but there doesn’t seem to be an equivalent of tribe_is_list_view for photo view.

    And I’ve added this code from list view but it doesn’t nothing:

    <?php if ( tribe_get_cost() ) : ?>
    	<div class="tribe-events-event-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; ?>
    #1354507
    Sarah Lewis-Hammond
    Participant

    Ok, nailed it.

    The book now button on list view actually just links to the booking button on the single event, so I’ve added this and it works poifekly.

    <div class="button"><a class="tribe-event-url" href="<?php echo esc_url( tribe_get_event_link() ); echo "?tickets_process=#buy-tickets" ?>" title="<?php the_title() ?>" rel="bookmark">book now</a></div>

    #1354695
    Geoff B.
    Member

    Good evening Sarah,

    Major kudos and thank you for sharing your solution.

    You are welcome back in our support forums any time 🙂

    For now, I am going to close this thread.

    Have a great week!

    Geoff B.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Adding a book now button to photo view’ is closed to new replies.