Advertisement
eventsmanager

Conditional Placeholder - General No-Tags

Jul 10th, 2014
555
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement