Search by End Date

Home Forums Calendar Products Events Calendar PRO Search by End Date

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1093021
    Justin
    Participant

    I would like to add an End Date to the search bar and wasn’t seeing an option in the settings to enable this option.

    #1093663
    Nico
    Member

    Hi 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,
    Nico

    #1094292
    Justin
    Participant

    Sounds good, go ahead and point me in the right direction.

    #1094777
    Nico
    Member

    That’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,
    Nico

    #1101407
    Support Droid
    Keymaster

    This 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.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Search by End Date’ is closed to new replies.