Support

Home Forums Event Espresso Premium Hide state field in venue address

Hide state field in venue address

Posted: December 9, 2015 at 2:48 pm

Viewing 3 reply threads


geoffmartyn

December 9, 2015 at 2:48 pm

Hi,

I’ve been struggling with the ‘unknown’ state problem in UK addresses for a while now and then found the following post:

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

I’ve added this into my functions, and while it does allow me to select a state, in this case a UK/GB county it still outputs this in the address regardless of the fact that I have GB addresses set to format thus:

$address_formats[ ‘GB’ ] = “{address}%{address2}%{city}%{zip}”;

I would much rather just hide the state/county field as it’s really not used at all in Scotland. For instance, Glasgow doesn’t have a county other than City of Glasgow, Edinburgh is in Lothian, Perth is in Fife but everyone knows that in Scotland so we generally don’t format an address in this way.

I’ve added the ee_adjust_formatting_venue_address function to my functions.php but as I say, nothing is changing.

Thanks

Geoff


Tony

  • Support Staff

December 10, 2015 at 6:21 am

Hi Geoff,

What that function does is alter the output of the address based on the country it is set within, so as a quick example if I view one of my venue pages, the address is set for Buckingham palace – http://take.ms/EJ98v

Without that function you mentioned above, here is the venue page – http://take.ms/X325A

(Note we have Unknown state and it shows UK at the end of the address)

Now doing nothing more than adding that function you linked to into functions.php (I recommend using a Site Specific Plugin over functions.php) and refreshing the page, I get this – http://take.ms/Ohj0pI

If I change the dropdown for country to something other thank UK (I used Canada – http://take.ms/0Fmt3) that format no longer applies as it thinks Im using a Canada address and should use that format, if I refresh the page after saving, I get this again – http://take.ms/resLj

There’s only a few places that use the function for this and they all work correctly for me when using that function, so I just want to check that we are talking about the same locations.

So, can you tell me where EE is still outputting the full address when using that filter please?

Do you have an event I can register on and view this?


geoffmartyn

December 10, 2015 at 3:12 pm

Hi Tony – thank you for taking the time to reply in such a detailed way. It made total sense with the screenshots too. When you mentioned the site specific plugin, I realised I had created one a few nights ago so checked that out and there was another custom function in there, conflicting with the new one. I took the new function out of functions.php, commented out the other function and replaced it in the site specific php and it works a charm.

Thank you once again for the brilliant support.

Best regards,

Geoff


Tony

  • Support Staff

December 13, 2015 at 1:59 pm

You’re most welcome, Geoff.

I’ glad you got it working, please let us know if you have any further problems 🙂

Viewing 3 reply threads

The support post ‘Hide state field in venue address’ 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