How can we help?
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:
[code lang=”php”]
<form method="GET" action="YOUR_EVENTS_PAGE_URL">
<p>
<label for="keywords">Keywords</label>
<input type="text" id="search_keywords" name="search_keywords" />
</p>
<p>
<label for="keywords">Location</label>
<input type="text" id="search_location" name="search_location" />
</p>
<p>
<label for="search_category">Category</label>
<select id="search_category" name="search_category">
<?php foreach ( get_event_listing_categories() as $cat ) : ?>
<option value="<?php echo esc_attr( $cat->term_id ); ?>"><?php echo esc_html( $cat->name ); ?></option>
<?php endforeach; ?>
</select>
</p>
<p>
<input type="submit" value="Search" />
</p>
</form>
[/code]
Replace YOUR_EVENTS_PAGE_URL with the URL to your events page (assuming filters are enabled) and the form will function.