Hiya,
This is possible, but will require you to do some custom coding. The code below makes it possible to show a list of events based on a custom “important” attribute:
add_filter('em_events_get_default_search','my_em_styles_get_default_search_important',1,2);
function my_em_styles_get_default_search_important($searches, $array){
if( !empty($array['important']) ){
$searches['important'] = $array['important'];
}
return $searches;
}
add_filter('em_events_get','my_em_important',1,2);
function my_em_important($events, $args){
if( !empty($args['important']) ){
foreach($events as $event_key => $EM_Event){
if ( !in_array($args['important'], $EM_Event->event_attributes) ){
unset($events[$event_key]);
}
}
}
return $events;
}
In a page you can then use;
[events_list important="telephone-etiquette"]
You’ll need to refine that to filter on the search form, however.
Thanks
Thread Starter
tkhan
(@tkhan)
Hi philipjohn,
Thanks for the quick reply that works for displaying an events list with my custom key (which no doubt will come in very handy), I do not have clue how to incorporate this as a filtering option in a search form however.
I also tried the tutorials Creating an Events Manager Add-On : A Complete Walkthrough. The style taxonomy? appeared under the events menu and the meta boxes appeared in the event posts the part I was interested in “Step 7 – Insert a style search drop-down menu into the events search form” code as follows
add_action('em_template_events_search_form_ddm', 'my_em_styles_search_form');
function my_em_styles_search_form(){
$my_em_styles = (is_array(get_option('my_em_styles'))) ? get_option('my_em_styles'):array();
?>
<!-- START Styles Search -->
<select name="style">
<option value=''>All Styles</option>
<?php foreach($my_em_styles as $style_id=>$style_name): ?>
<option value="<?php echo $style_id; ?>" <?php echo ($_POST['style'] == $style_id) ? 'selected="selected"':''; ?>><?php echo $style_name; ?></option>
<?php endforeach; ?>
</select>
<!-- END Styles Search -->
<?php
}
did not seem to work however, I added the code to the top of my themes functions.php
Yours Tkhan
You will also probably need to look at editing the search template for managing your extra field.
Unless you’re an experienced coder it’s probably worth seeking the assistance of a developer on this one, really.
Thanks
Thread Starter
tkhan
(@tkhan)
thanks for the prompt reply
Will have a mess around see what I can come up with, if need be I can always resort to creating a custom taxonomy and add this into the form.
Tkhan