Skip to content

Instantly share code, notes, and snippets.

@lorenzocaum
Last active June 9, 2017 06:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lorenzocaum/5e2658a1f7e7a9a6b5c0 to your computer and use it in GitHub Desktop.
Save lorenzocaum/5e2658a1f7e7a9a6b5c0 to your computer and use it in GitHub Desktop.
How to change the formatting of the venue address in Event Espresso 4

Add the sample code below to your child theme's functions.php file or in a site specific plugin.

<?php
//* Do NOT include the opening php tag

//* Change formatting for the venue address for the United Kingdom and Canada and Germany and Singapore
function ee_adjust_formatting_venue_address( $address_formats ) {
    $address_formats[ 'GB' ] = "{address}%{address2}%{city}%{zip}";
    $address_formats[ 'CA' ] = "{address}%{address2}%{city}%{state}%{country}%{zip}";
    $address_formats[ 'DE' ] = "{address}%{address2}%{zip} {city}";
    $address_formats[ 'NL' ] = "{address}%{address2}%{zip} {city}";
    $address_formats[ 'SG' ] = "{address}%{address2}%{city}%{country}%{zip}";
    return $address_formats;
}
add_filter( 'FHEE__EE_MultiLine_Address_Formatter__address_formats', 'ee_adjust_formatting_venue_address', 10, 1 );
add_filter( 'FHEE__EE_Inline_Address_Formatter__address_formats', 'ee_adjust_formatting_venue_address', 10, 1 );
@boethius
Copy link

Hi Thanks for this snippet, while it works for venues, it doesn't change the way the information is displayed in the messages. I guess I could just hardcode the address in each single template, but that wouldn't make sense?

@greyowl7
Copy link

greyowl7 commented Jun 9, 2017

I included a line for 'CH' (Switzerland) and put this snippet in functions.php in my child theme folder, but the address shown on the All Venues page still has the old format (City, Zip instead of Zip City). Also tried setting my site to 'DE' (Germany) – no change. Am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment