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
;
}