Home › Forums › Calendar Products › Events Calendar PRO › Search by End Date
- This topic has 4 replies, 3 voices, and was last updated 10 years ago by
Support Droid.
-
AuthorPosts
-
March 23, 2016 at 11:32 am #1093021
Justin
ParticipantI would like to add an End Date to the search bar and wasn’t seeing an option in the settings to enable this option.
March 24, 2016 at 1:58 pm #1093663Nico
MemberHi there Justin,
Welcome to our support forums and thanks for reaching out to us. I’ll help you here…
There’s actually no setting to add this to the events search bar. I guess this is possible with some custom work on the search bar to add the field and then modifying the events query to add that parameter. Unfortunately crafting this type of customizations is out of the scope of the support we can provide. If you feel like giving this a try I can totally point you in the right direction and give you an overview of how I would do this.
Please let me know about it,
Best,
NicoMarch 25, 2016 at 4:12 pm #1094292Justin
ParticipantSounds good, go ahead and point me in the right direction.
March 28, 2016 at 8:15 am #1094777Nico
MemberThat’s great! They way I would do this is the following:
First add the new ‘end date filter’ to the filters array, so it show’s in the front-end. Take a look at how the ‘start date filter’ is added in the-events-calendar/src/Tribe/Main.php, lines 459 & 4417. Once that’s in place and showing on the front-end of the site, you’ll need to alter the events query to include the date limit. You can see how the start date is altering the query in the-events-calendar/src/Tribe/Query.php at line 200. You can do something similar by adding this snippet to the functions.php file:
function modifi_bar_query ( $query ) {// change the field name
if ( ! empty( $_REQUEST['tribe-bar-end-date'] ) ) {
// print_r($query);
// alter the query
}return $query;
}add_filter( 'tribe_events_pre_get_posts', 'modifi_bar_query');
Hope this helps you getting started! Please note that you shouldn’t edit the core files, but add the filter and custom code inside your theme functions.php file.
Please let me know about it,
Best,
NicoApril 12, 2016 at 9:35 am #1101407Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Search by End Date’ is closed to new replies.
