eventsmanager icon

Custom conditional placeholder for event attribute

eventsmanager | PRO | 07/21/25 07:00:33 AM UTC | 0 ⭐ | 333 👁️ | Never ⏰ | []
text |

630 B

|

None

|

0 👍

/

0 👎

/*
{has_website}
<h4>Website</h4>
#_ATT{website}
{/has_website}
 */
function my_em_has_attribute_event_output_condition($replacement, $condition, $match, $EM_Event){
    if( is_object($EM_Event) && preg_match('/^has_website$/',$condition, $matches) ){
        if( !in_array($args['website'],$EM_Event->event_attributes) && !empty($EM_Event->event_attributes['website']) ){
            $replacement = preg_replace("/\{\/?$condition\}/", '', $match);
        }else{
            $replacement = '';
        }
    }
    return $replacement;
}
add_action('em_event_output_condition', 'my_em_has_attribute_event_output_condition', 100, 4);
 

Comments