eventsmanager

Custom conditional placeholder for event attribute

Jul 21st, 2025
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. /*
  2. {has_website}
  3. <h4>Website</h4>
  4. #_ATT{website}
  5. {/has_website}
  6. */
  7. function my_em_has_attribute_event_output_condition($replacement, $condition, $match, $EM_Event){
  8. if( is_object($EM_Event) && preg_match('/^has_website$/',$condition, $matches) ){
  9. if( !in_array($args['website'],$EM_Event->event_attributes) && !empty($EM_Event->event_attributes['website']) ){
  10. $replacement = preg_replace("/\{\/?$condition\}/", '', $match);
  11. }else{
  12. $replacement = '';
  13. }
  14. }
  15. return $replacement;
  16. }
  17. add_action('em_event_output_condition', 'my_em_has_attribute_event_output_condition', 100, 4);
  18.  
Advertisement
Add Comment
Please, Sign In to add comment