Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

commented Nov 21, 2016

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

This comment has been minimized.

Copy link

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
You can’t perform that action at this time.