BakerMan

Address conversion

Apr 25th, 2013
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. <!-- Find the following in full-address.php: -->
  2.  
  3. <?php if( tribe_get_country( $postId ) ) { ?>
  4.     <?php $address_out []= '<span itemprop="addressCountry">' . tribe_get_country( $postId ) . '</span>'; ?>
  5. <?php } ?>
  6.  
  7.  
  8. <!-- Replace with something like this: -->
  9.  
  10. <?php
  11. if( tribe_get_country( $postId ) ) {
  12.     $country = tribe_get_country( $postId );
  13.  
  14.     // A switch statement is an ungainly way of doing this, it would
  15.     // be preferable to use a lookup table - but this gives an idea
  16.     // of the basic mechanics
  17.     switch ( $country ) {
  18.         case 'Canada':
  19.             $country = 'CA';
  20.         break;
  21.         case 'United States':
  22.             $country = 'US';
  23.         break;
  24.     }
  25.    
  26.     $address_out []= '<span itemprop="addressCountry">' . esc_html( $country ) . '</span>';
  27. }
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment