Viewing 4 replies - 1 through 4 (of 4 total)
  • Is this the one you’ve followed https://wp-events-plugin.com/tutorials/creating-custom-event-search-attributes/ and is there any chance to post your code here? and also, are you talking about the search form in the events page? and can you give more details about your issue?

    Thread Starter ktib

    (@ktib)

    Hi agelonwl,

    For now I haven’t tried anything. I just installed events-manager, and the search form on the events page has many different fields by default: by date, by region, by state, by country, etc…
    However, it doesn’t include a field to search “by name of location”. If a user wants to see all upcoming events for a specific location, he will have to go on the page of that location; but the average guy won’t do that. Isn’t there a way to include that in the search form?

    Also, the search form by default doesn’t include a field to search “by town”. I find it strange, but I don’t specifically need it so don’t bother explaining me how to include it.

    Thanks for the reply and have a good day!

    If you do your own search form then just sending a name="location_id" field back in the search will give you the results you want.

    It’s easy to do your own search form. A category search can by dynamically generated like this:

    <?php $terms = get_terms("event-categories");
    if ( count($terms) > 0 ) { ?>
        <select name='category' id='category' class='em-events-search-category' >
            <option value='-1'>Event type</option>
    <?php   foreach ( $terms as $term ) { ?>
            <option class="level-0" value="<?= $term->term_id ?>"><?= $term->name ?></option>
    <?php   } ?>
        </select>
    <?php } ?>

    – do the same for the locations with $locations = EM_Locations::get(); then $location->location_id

    The default search script will pick up and filter on location_id. This doesn’t seem to be a documented feature.

    Key point is that the third line must be <select name=”location_id” …

    Thanks richplane for this, I couldn’t find the info anywhere

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Events Manager] Event search: By location’ is closed to new replies.