Event search filter drop-down list

This topic contains 4 replies, has 2 voices, and was last updated by  Adnan Akbas 4 years, 11 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #32064

    I have a search page with filter country so that users can select to search upcoming events in a specific country.

    [event_search filters=”country”]

    If there is no more an upcoming event for a country, this country still exists in the filter drop-down list.

    It would be nice not to see this country if there is no more events there.

    Is this a setting issue?

    Adnan Akbas
    #32125

    Hi Adnan,

    No, the countries are listed even when there’s not future events in that country. This is the same as with the other filters.

    Stephen Harris
    #37097

    Hi Stephen,

    Do you have a hint for me, how I can remove these countries from the dropdown list if there is no event for this country?

    Thanks in advance,

    Adnan

    Adnan Akbas
    #37110

    The code is in line 267 of includes/shortcode.php – essentially you would need to iterate over every country in $countries and query for events in that country. If there are none, then skip it.

    An example query would be:

    $future_uk_events = eo_get_events( array( 
           'venue_query' => array( 
                array(
                    'key' => '_country',
                    'value' => 'UK'
                )
            ),
            'event_start_after' => 'today'
     ));
    

    (see http://docs.wp-event-organiser.com/querying-events/getting-events-via-venue-queries/)

    But this is not particular performant, as you are doing a query for each country

    Stephen Harris
    #37143

    Hi Stephen,

    I am not really a fan of changing core files therefore I will leave the countries in the dropdown list for now.

    Thank you for your support.

    Adnan Akbas
Viewing 5 posts - 1 through 5 (of 5 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.