SHARE
TWEET

Conditional Placeholder - General No-Tags

eventsmanager Jul 10th, 2014 338 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_action('em_event_output_condition', 'my_em_general_notag_event_output_condition', 1, 4);
  2. function my_em_general_notag_event_output_condition($replacement, $condition, $match, $EM_Event){
  3.         if( preg_match('/^no_tags$/',$condition, $matches) ){
  4.                 $tags = get_the_terms($EM_Event->post_id, EM_TAXONOMY_TAG);
  5.                 if( is_array($tags) && count($tags) > 0 ){
  6.                         $replacement = "";
  7.                 }else{
  8.                         $replacement = preg_replace("/\{\/?$condition\}/", '', $match);
  9.                 }
  10.                
  11.         }
  12.         return $replacement;
  13. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top