fbpx
Participate in our upcoming live webinar to learn how you can manage your commissions with the Stripe Split Payment on 31st July at 10 pm IST. Register Now
How can we help?

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()
{ ?>
    <div class="wpem-events-filter-block">
        <?php $search_location = isset($_GET['search_location']) ? $_GET['search_location'] : ''; ?>
        <div class="wpem-form-group"><input name="search_location" id="search_location" type="text" value="<?php echo $search_location; ?>" placeholder="<?php _e('Location','wp-event-manager');?>"></div>
    </div>
<?php }
add_filter( 'event_manager_get_dashboard_events_args', 'my_theme_custom_search', 10 );
function my_theme_custom_search($args)
{
    if( isset($_GET['search_location']) && !empty($_GET['search_location']) )
    {
        $location_meta_keys = array( 'geolocation_formatted_address', '_event_location', 'geolocation_state_long' );
        $location_search    = array( 'relation' => 'OR' );
        foreach ( $location_meta_keys as $meta_key ) {
            $location_search[] = array(
                'key'     => $meta_key,
                'value'   => $_GET['search_location'],
                'compare' => 'like'
            );
        }
        $args['meta_query'][] = $location_search;
    }
    return $args;
}

Add A Custom Field In The Search Form On The Event Dashboard
Editorial Team

Our team constantly explores ways that technology can help us reinvent industries. We want to change the world by creating great products that transform industries. We Dream It, We Make It.

Quick Links
Close
Close