Advertisement
Guest User

Events Manager 'has_VenueURL' Custom Conditional

a guest
May 3rd, 2012
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. /**
  2.  * Function: Events Manager 'has_VenueURL' Custom Conditional Placeholder
  3.  */
  4. add_action('em_event_output_condition', 'my_em_VenueURL_event_output_condition', 1, 4);
  5. function my_em_VenueURL_event_output_condition($replacement, $condition, $match, $EM_Event){
  6.     if( is_object($EM_Event) && preg_match('/^has_VenueURL_(.+)$/',$condition, $matches) && is_array( $EM_Event->VenueURL ) ){
  7.         if( in_array($matches[1],$EM_Event->VenueURL) ){
  8.             $replacement = preg_replace("/\{\/?$condition\}/", '', $match);
  9.         }else{
  10.             $replacement = '';
  11.         }
  12.     }
  13.     return $replacement;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement