Advertisement
BakerMan

Full Address (Do not show US) TEC/ECP

Nov 5th, 2012
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.60 KB | None | 0 0
  1. <?php
  2. /**
  3. * Render an address. This is used by default in the single event view.
  4. *
  5. * This version has been modified to hide "United States" from the address.
  6. */
  7.  
  8. // Don't load directly
  9. if ( !defined('ABSPATH') ) { die('-1'); }
  10.   if( !isset($postId) ) $postId = null;
  11. ?>
  12. <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
  13.     <?php $address_out = Array() ?>
  14.     <?php if( isset($includeVenueName) && $includeVenueName && tribe_get_venue( $postId ) ) { ?>
  15.         <?php $address_out []= '<span itemprop="addressLocality">' . tribe_get_venue( $postId ) .'</span>'; ?>
  16.     <?php } ?>
  17.  
  18.     <?php if( tribe_get_address( $postId ) ) { ?>
  19.         <?php $address_out []= '<span itemprop="streetAddress">' . tribe_get_address( $postId ) . '</span>'; ?>
  20.     <?php } ?>
  21.  
  22.     <?php
  23.     $cityregion = '';
  24.     if( tribe_get_city( $postId ) ) {
  25.         $cityregion .= tribe_get_city( $postId );
  26.     }
  27.     if( tribe_get_region( $postId ) ) {
  28.         if( $cityregion != '' ) $cityregion .= ', ';
  29.         $cityregion .= tribe_get_region( $postId );
  30.     }
  31.     if( $cityregion != '' ) { ?>
  32.         <?php $address_out []= '<span itemprop="addressRegion">' . $cityregion . '</span>'; ?>
  33.     <?php } ?>
  34.  
  35.     <?php if( tribe_get_zip( $postId ) ) { ?>
  36.         <?php $address_out []= '<span itemprop="postalCode">' . tribe_get_zip( $postId ) . '</span>'; ?>
  37.     <?php } ?>
  38.  
  39.     <?php if( tribe_get_country( $postId ) !== 'United States' ) { ?>
  40.         <?php $address_out []= '<span itemprop="addressCountry">' . tribe_get_country( $postId ) . '</span>'; ?>
  41.     <?php } ?>
  42.  
  43.     <?php if ( count( $address_out ) > 0 ) : ?>
  44.     <?php echo implode( ', ', $address_out ); ?>
  45.     <?php endif; ?>
  46. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement