Advertisement
Beee

#_COUNTRYFLAG

Jun 16th, 2017
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.55 KB | None | 0 0
  1. function em_country_flag( $replace, $EM_Event, $result ) {
  2.     if ( $result == '#_COUNTRYFLAG' ) {
  3.         $country_code = $EM_Event->location->country;
  4.         if ( $country_code ) {
  5.             $country_code = strtolower( $country_code );
  6.             $replace      = '<img src="' . get_stylesheet_directory_uri() . '/assets/img/flags/' . $country_code . '.png" alt="" class="flag" />';
  7.         } else {
  8.             $replace = false;
  9.         }
  10.     }
  11.  
  12.     return $replace;
  13. }
  14. add_filter( 'em_event_output_placeholder', 'em_country_flag', 1, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement