SHARE
TWEET

Custom Conditional Placeholder For Events Category

eventsmanager Mar 25th, 2020 150 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Events Category Custom Conditional Placeholder
  3.  
  4. e.g. should be place under Events > Settings > Formatting > Event Categories > Categories list item format Or Single category page format
  5.  
  6. */
  7. add_action('em_category_output_condition', 'my_em_custom_category_output_condition', 100, 4);
  8. function my_em_custom_category_output_condition($replacement, $condition, $match, $EM_Taxonomy_Term){
  9.     if( is_object($EM_Taxonomy_Term) && preg_match('/^has_category_notes/',$condition, $matches) ){
  10.         if( !empty(trim($EM_Taxonomy_Term->description)) ){
  11.             $replacement = preg_replace("/\{\/?$condition\}/", '', $match);
  12.         }else{
  13.             $replacement = '';
  14.         }
  15.     }
  16.     return $replacement;
  17. }
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
Top