Support

Home Forums Event Espresso Premium Formatting venue address [EE4>

Formatting venue address [EE4>

Posted: January 6, 2015 at 6:30 am

Viewing 6 reply threads


dario de caneva

January 6, 2015 at 6:30 am

Hi, I would like to render the vuneu address in this way:
address
zip city state
(i don’t need the country)

I tried to set multiline instead of inline but is not what i need.
What can i do?


dario de caneva

January 6, 2015 at 6:34 am

Do i have to modify the EEH_Formatter.helper.php?
In that case how can i save changes when i will upgrade the plugin?
Do i have to move somewhere that file in my theme folder?


Dean

January 6, 2015 at 7:06 am

Hi,

It doesn’t look very easy to do currently. The function that controls the output is EE_MultiLine_Address_Formatter (or EE_Inline_Address_Formatter).

I think the best I can offer currently would be to put in a request for a filter to be added to those two methods so that the data can be modified before being output.


dario de caneva

January 6, 2015 at 7:35 am

I modified:
class EE_MultiLine_Address_Formatter implements EEI_Address_Formatter {
public function format( $address, $address2, $city, $state, $country, $zip ) {
$formatted_address = $address;
$formatted_address .= ! empty( $address2 ) ? ‘<br/>’ . $address2 : ”;
$formatted_address .= ! empty( $zip ) ? ‘<br/>’ . $zip : ”;
$formatted_address .= ! empty( $city ) ? ‘ ‘ . $city : ”;
$formatted_address .= ! empty( $city ) && ! empty( $state ) ? ‘ ‘ : ”;
$formatted_address .= ! empty( $state ) ? $state : ”;
return $formatted_address;
}
}

and it seams it works.
Could this modify give me some problem?


Dean

January 6, 2015 at 7:37 am

Problems? Doubtful, but I would check the various areas where the venue is shown. The one issue that you will have is that on update the plugin will over write those changes.


Dean

April 1, 2015 at 6:25 am

Re-opened this forum thread temporarily as these is a way to modify the venue address without modifying the core files. Please see this thread: https://eventespresso.com/topic/address-still-now-showing-correctly/#post-143031


Lorenzo Orlando Caum

  • Support Staff

September 12, 2015 at 11:23 am

Hi there Dario,

We wanted to let you know about an enhancement in the current version of Event Espresso 4 that offers more flexibility for venue addresses.

First, please backup your WordPress site and upgrade to the latest release of Event Espresso 4:

https://eventespresso.com/wiki/ee4-changelog/

Next, there is some sample code in this link:

https://gist.github.com/lorenzocaum/5e2658a1f7e7a9a6b5c0

Here is an explanation of the sample code:

In the older versions of Event Espresso, you could change the formatting for the venue address. However, this would apply to all venue addresses. The new enhancement is more flexible as it allows you to change the formatting for certain countries.

In the example code, we have an entry for United Kingdom which has a country code of GB. Then we have the actual formatting which doesn’t include the province or the country name.

Just below that, we have an entry for Canada which has a country code of CA. In Canada, the zip/postal code appears as the end of the address so the formatting will show it in that order.

If you have modified the venue address through an existing function, then you may consider switching to the new one mentioned in the link above.

Thanks!


Lorenzo

Viewing 6 reply threads

The support post ‘Formatting venue address [EE4>’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso