Home › Forums › Calendar Products › Events Calendar PRO › Adding a book now button to photo view
- This topic has 5 replies, 2 voices, and was last updated 8 years, 7 months ago by
Sarah Lewis-Hammond.
-
AuthorPosts
-
September 21, 2017 at 4:16 am #1352485
Sarah Lewis-Hammond
ParticipantHello! 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.
September 21, 2017 at 9:40 am #1352799Geoff B.
MemberGood 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:
- 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.
- 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.
September 25, 2017 at 12:54 pm #1354497Sarah Lewis-Hammond
ParticipantHiya
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; ?>September 25, 2017 at 1:09 pm #1354507Sarah Lewis-Hammond
ParticipantOk, 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>September 25, 2017 at 8:11 pm #1354695Geoff B.
MemberGood 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.
- 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
-
AuthorPosts
- The topic ‘Adding a book now button to photo view’ is closed to new replies.
