Advertisement
eventsmanager

Custom Conditional Placeholder For Location Town

Nov 16th, 2021
515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. /*
  2. * {has_location_town} #_LOCATIONTOWN {/has_location_town}
  3. */
  4. add_action('em_location_output_condition', 'my_em_has_location_output_condition', 1, 4);
  5. function my_em_has_location_output_condition($replacement, $condition, $match, $EM_Location){
  6. if( is_object($EM_Event) && preg_match('/^has_location_town/',$condition, $matches) ){
  7. if( !empty($EM_Location->location_town) ){
  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