Forums › Forums › Search & Filter Pro › Using CPT for search filter
Tagged: cpt
- This topic has 15 replies, 2 voices, and was last updated 7 years, 6 months ago by Trevor.
-
Anonymous(Private) June 20, 2017 at 10:33 am #115829
Hi Trevor,
I have managed to get this working now, however, the code repeats itself and adds the month header on top of each event when it is meant to list all events of a single month in one header e.g all events in may should be listed under the may header but it currently adds the may header to each event in may. Please see below for code that is in the results.php file:
`
if ( $query->have_posts() ) { ?><div id=”tribe-events-content” class=”tribe-events-list”>
<div class=”events-loop tribe-events-loop vcalendar”>
<div class=”row”>
<div class=”tribe-events-page-title-wrap” style=”position: relative; text-align:center;”>
<h2 class=”tribe-events-page-title”>All Events</h2>
</div><?php while ($query->have_posts()) { $query->the_post(); ?>
<?php if ( ! defined( ‘ABSPATH’ ) ) { die( ‘-1’ ); } // Setup an array of venue details for use later in the template $venue_details=t ribe_get_venue_details(); if ( isset( $venue_details[ ‘linked_name’] ) ) { $venue_name=$ venue_details[ ‘linked_name’]; } elseif ( isset( $venue_details[ ‘name’] ) ) { $venue_name=$ venue_details[ ‘name’]; } else { $venue_name=” ; } // Venue $has_venue_address=( ! empty( $venue_details[ ‘address’] ) ) ? ‘ location’ : ”; // Organizer $organizer=t ribe_get_organizer(); ?>
<?php do_action( ‘tribe_events_inside_before_loop’ ); ?>
<!– Month / Year Headers –>
<?php tribe_events_list_the_date_headers(); ?><?php do_action( ‘tribe_events_inside_after_loop’ ); ?>
`
code for the event loop then goes here followed by:
`
<?php } else { echo ‘<div class=”upcoming-event-title” style=”padding:10px; background-color:#454545;”>
<p style=”text-align:center; color:white;”>
Oops! There are no events found matching your search selection. </p>
</div>’; } ?>
`
The main bit of code that makes the month header work is below:
`
<?php tribe_events_list_the_date_headers(); ?>
`
It may be easier to show you the code and explain the issue in a call if the this is confusing.
Thanks,
Ihtezaz -
AuthorPosts