Home › Forums › Ticket Products › Event Tickets Plus › How to get WooTickets to show in main blog loop
- This topic has 7 replies, 2 voices, and was last updated 8 years, 7 months ago by Geoff.
-
AuthorPosts
-
August 30, 2015 at 7:10 pm #1000336HannahParticipant
Hey,
I got the events to show in the main blog loop, however I also need the wootickets form on the main page posts and I”m not really sure how to get it there.
I’m pretty sure this isn’t a bug or conflict, it just looks like whatever the plugin looks for to post the form isn’t part of the blog version of events.Thanks
August 31, 2015 at 1:41 pm #1000622GeoffMemberHey Hannah and welcome to the forums. 🙂
Good question and you’re absolutely right: adding events to the site’s main post query will simply format events to the main post type, as it’s formatted in the template containing the loop for your homepage.
If you want, you can add the ticket form to the template’s loop using something like:
if ( tribe_is_event && tribe_events_has_tickets ) { echo tribe_get_ticket_form(); }
Place that in the loop where you would like the ticket form to display and it should fetch the ticket form if the post is an event and has tickets available.
Cheers!
GeoffAugust 31, 2015 at 9:50 pm #1000775HannahParticipantHey Geoff,
I tried putting to code in the loop’s template file but it still doesn’t show up. I just stuck it after the main content (see below), did I do it wrong? Or can it not tell that the post was an event post. The page still functions so I don’t think I broke anything.
<div class="entry-content"> <?php if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it. the_post_thumbnail();} ?> <?php the_content( sprintf( /* translators: %s: Name of current post. */ wp_kses( __( 'Continue reading %s <span class="meta-nav">→</span>', 'piggyback' ), array( 'span' => array( 'class' => array() ) ) ), the_title( '<span class="screen-reader-text">"', '"</span>', false ) ) ); ?> <?php if ( tribe_is_event && tribe_events_has_tickets ) { echo tribe_get_ticket_form(); } ?> </div><!-- .entry-content -->
September 1, 2015 at 7:47 am #1000881GeoffMemberHi Hannah,
Oh shoot, I think I have led you down a wrong path and I’m super sorry!
Getting the ticket form in the content of the post in the homepage feed is quite a tricky task. However, one option you might consider is displaying information that tickets are available, if there are any. For example:
<?php if ( tribe_is_event() && tribe_events_has_tickets() ) { echo '<p>' . tribe_events_count_available_tickets() . ' Tickets Available</p>'; } ?>
This will show how many tickets are available for a ticket, if there are tickets at all.
You can use that same condition to style an event with tickets differently than regular posts or even other events that do not have tickets to distinguish things even further.
Sorry for striking out the first time, but does this help instead? Please let me know. 🙂
Thanks!
GeoffSeptember 1, 2015 at 8:13 am #1000890HannahParticipantHow tricky are we talking? Linking through to the ticketing page is a workable solution, but if getting the tickets on the homepage is possible I wouldn’t mind having a whack at it.
Thanks for all your help insofar.
September 1, 2015 at 8:28 am #1000903GeoffMemberI think it’s tricky enough to require including other templates into the template with the content loop and possibly even enqueuing scripts to make it happen. I’m afraid it would be well outside the level of customization we would be able to support here in the forums.
So, linking the snippet I provided before would look something like this:
<?php if ( tribe_is_event() && tribe_events_has_tickets() ) { echo '<p><a href="' . esc_url( tribe_get_event_link() ) . '">' . tribe_events_count_available_tickets() . ' Tickets Available</a></p>'; } ?>
Geoff
September 1, 2015 at 10:23 pm #1001118HannahParticipantAlrighty then, thanks for the link solution, works like a peach.
Hannah
September 2, 2015 at 6:52 am #1001207GeoffMemberMy pleasure and thanks for letting me know! I’ll go ahead and close this thread but please do feel free to hit us up with a new one if any other questions pop up and we’d be happy to help. 🙂
Cheers!
Geoff -
AuthorPosts
- The topic ‘How to get WooTickets to show in main blog loop’ is closed to new replies.