Advertisement
eventsmanager

Custom Conditional Placeholder For Events Category

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