Skip to content

Instantly share code, notes, and snippets.

@andrasguseo
Last active January 18, 2023 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrasguseo/988d4402c3316d5b17decab382abd901 to your computer and use it in GitHub Desktop.
Save andrasguseo/988d4402c3316d5b17decab382abd901 to your computer and use it in GitHub Desktop.
TEC > German formatting for venue address
<?php
/**
* Address Module Template
*
* This is a template override for the venue meta data.
* Venue data is formatted for Germany.
*
* Save this template in your own theme by creating a file at:
* [your-theme]/tribe-events/modules/address.php
*
* This file overrides this template:
* the-events-calendar/src/views/modules/address.php
*
* Plugins required: The Events Calendar
* Author: Andras Guseo
* Last updated: January 18, 2023
* @version 6.0.0
*
*/
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
$venue_id = get_the_ID();
$full_region = tribe_get_full_region( $venue_id );
?>
<span class="tribe-address">
<?php
// This location's street address.
if ( tribe_get_address( $venue_id ) ) : ?>
<span class="tribe-street-address"><?php echo tribe_get_address( $venue_id ); ?></span>
<?php if ( ! tribe_is_venue() ) : ?>
<br>
<?php endif; ?>
<?php endif; ?>
<?php
// This location's postal code.
if ( tribe_get_zip( $venue_id ) ) : ?>
<?php
// If it is a venue and there is already a street address, then add a line break.
if ( tribe_is_venue() && tribe_get_address( $venue_id ) ) :
?>
<br>
<?php endif; ?>
<span class="tribe-postal-code"><?php echo tribe_get_zip( $venue_id ); ?></span>
<?php endif; ?>
<?php
// This locations's city.
if ( tribe_get_city( $venue_id ) ) : ?>
<span class="tribe-locality"><?php echo tribe_get_city( $venue_id ); ?></span>
<?php endif; ?>
<?php
// This location's country.
if ( tribe_get_country( $venue_id ) ) : ?>
<?php if ( tribe_is_venue() && tribe_get_address( $venue_id ) ) : ?>
<br>
<?php else: ?>
<span class="tribe-delimiter">,</span>
<?php endif; ?>
<?php
// This location's abbreviated region. Full region name in the element title.
if ( tribe_get_region( $venue_id ) ) : ?>
<abbr class="tribe-region tribe-events-abbr" title="<?php esc_attr_e( $full_region ); ?>"><?php echo tribe_get_region( $venue_id ); ?></abbr><span class="tribe-delimiter">,</span>
<?php endif; ?>
<span class="tribe-country-name"><?php echo tribe_get_country( $venue_id ); ?></span>
<?php endif; ?>
</span>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment