Creating a custom event search form

Creating a custom event search form

WP Event Manager’s [Events] shortcode is coded to pick up search_location and search_keywords variables from the query string. Because of this, it’s easy to create a search form elsewhere on your site which posts to your events page.

How to Create a custom event search form

Here is an example form:

  1. <form method="GET" action="YOUR_EVENTS_PAGE_URL">
  2.   <p>
  3.     <label for="keywords">Keywords</label>
  4.     <input type="text" id="search_keywords" name="search_keywords" />
  5.   </p>
  6.   <p>
  7.     <label for="keywords">Location</label>
  8.     <input type="text" id="search_location" name="search_location" />
  9.   </p>
  10.   <p>
  11.     <label for="search_category">Category</label>
  12.     <select id="search_category" name="search_category">
  13.         <?php foreach ( get_event_listing_categories() as $cat ) : ?>
  14.             <option value="<?php echo esc_attr( $cat->term_id ); ?>"><?php echo esc_html( $cat->name ); ?></option>
  15.         <?php endforeach; ?>
  16.     </select>
  17.   </p>
  18.   <p>
  19.     <input type="submit" value="Search" />
  20.   </p>
  21. </form>

Replace YOUR_EVENTS_PAGE_URL with the URL to your events page (assuming filters are enabled) and the form will function.


    • Related Articles

    • Add a custom field in the search form on the event dashboard

      In order to add customize search filters to the event dashboard, please enter the following code in the functions.php file: add_action('event_manager_event_dashboard_event_filter_start', 'my_theme_custom_filter'); function my_theme_custom_filter() { ...
    • Add custom field in Search filter

      It is possible for the users of WP Event Manager to add new filters to the event search form. In this guide we will show you how you can do it. Creating a custom event search filter WP Event Manager’s [Events] shortcode shows a search filter on the ...
    • Editing Event Submission Form Fields

      There are mainly 2 ways to customize the form fields in WP Event Manager : Using the Field editor option from the admin panel. Using the WordPress hooks (filters) which are explained below. Using the field editor option from the admin panel To add, ...
    • Create or pick categories from Free/ Core WP Event manager

      Events are classified into various types based on the kind of visitors they have. Visitors come from different backgrounds. That is why an event organizer or admin must ensure that they make a lot of event categories available to their clients. This ...
    • Create or pick categories from Free/ Core WP Event manager

      Events are classified into various types based on the kind of visitors they have. Visitors come from different backgrounds. That is why an event organizer or admin must ensure that they make a lot of event categories available to their clients. This ...