If I filter the event list on events archive page with the searchform (name, venue, category, time), the function eo_get_bookings() in template seems not to work correctly. Without using a filter everything is fine.
I use this code on template file “eo-loop-single-event.php”:
<?php
$bookings = eo_get_bookings( array(
'status'=>'reserved',
'event_id' => get_the_ID(),
'occurrence_id' => ''
) );
$reservations = 0;
if( $bookings ){
foreach( $bookings as $booking ){
$reservations += eo_get_booking_meta( $booking->ID, 'ticket_quantity' );
}
}
?>
I’m using a own status “reserved”, but it’s the same with “pending” status.
Without filter $bookings is an array with elements, with filter it’s an empty array.
Marciel Bartzik
Marciel Bartzik
It seems that the bug depends on the fact, that the filters are working as a wordpress search by using ?s= in url, so that WordPress uses the search.php template to show the event list. If I manually kill this parameter from url, it works fine again.
Marciel Bartzik
May I ask for help again?
Marciel Bartzik
Hi Marciel,
Are you using the event search shortcode? If so, it shouldn’t be using the ?s
query parameter in the URL, but instead eo_search[s]
query parameter.
The query that gets passed to WP_Query
does include s
with the search term – but this shouldn’t impact the template that is used.
Stephen Harris
Hi Stephen,
I implemented it by using <?php eo_get_event_search_form(); ?>
in archive-event.php as fixed part of the template file.
Marciel Bartzik