Hi Julio,
Something I want to add soon, but atm you’d need to make a custom conditional placeholder for it – http://wp-events-plugin.com/tutorials/create-a-custom-placeholder-for-event-formatting/
if you search these forums, I remember someone having done this before.
Thanks a lot,
I’ve managed to do it using this code:
function my_em_has_attribute_event_output_condition($replacement, $condition, $match, $EM_Event){
// Attribute_1
if( is_object($EM_Event) && preg_match(‘/^has_Attribute_1$/’,$condition, $matches) ){
if( !in_array($args[‘Attribute_1’],$EM_Event->event_attributes) && !empty($EM_Event->event_attributes[‘Attribute_1’]) ){
$replacement = preg_replace(“/\{\/?$condition\}/”, ”, $match);
}else{
$replacement = ”;
}
}
// Attribute_2
if( is_object($EM_Event) && preg_match(‘/^has_Attribute_2/’,$condition, $matches) ){
if( !in_array($args[‘Attribute_2’],$EM_Event->event_attributes) && !empty($EM_Event->event_attributes[‘Attribute_2’]) ){
$replacement = preg_replace(“/\{\/?$condition\}/”, ”, $match);
}else{
$replacement = ”;
}
}
return $replacement;
}
add_action(’em_event_output_condition’, ‘my_em_has_attribute_event_output_condition’, 1, 4);
Thanks for your support!
I’m using event manager 5.4.4 and i need to use conditional event attribute. I think your solution could fit to my needs… Where you put this code? “Attribute_1” is a general name for an attribute? I mean, in your case you used “Age” instead of “Attribute_1” in your code?