It would be nice if a venue could be a simple string, not necessarily complete geographic information.
John Foerch
The geographical information is optional. In future versions the default templates won’t display a map if the venue lacks geographical information – but in general, you can edit the templates to remove this.
Stephen Harris
Thanks. I was initially confused because I created an event, and wrote some text in the “venue” blank, and it did not get saved. Then when I created a venue, it displayed a map no matter what. Thank you.
John Foerch
I am confused about this. When I create a venue and add no address information, it is still showing a map. I have some venues where we want the map to show and others where we want no map, just the text name of the venue listed.
It seems that a default latitude and longitude are entered in the database even if you have not entered any location information. I guess we could code something in the templates that would check if all the address fields are blank (you never know which ones a user fills in) and then don’t display the map. Is there a better workaround?
It would be nice if this was the default behavior of the plug-in or if there was a checkbox per venue – don’t display map.
dcb
Hi dcb,
Yes, by default the co-ordinates (0,0)
are entered as venue meta. If you want to not display the map you can do so by editing the templates something like the following should work:
if( !empty( eo_get_venue_lat( $venue_id ) ) || !empty( eo_get_venue_lng( $venue_id ) ){
echo eo_get_venue_map( $venue_id );
}
Stephen Harris
Hi Stephen,
This is not working for me, because when I enter a new venue and fill in the title field only it doesn’t appear to add 0,0 as the default location coordinates. When I save the venue without any location data then output the values for lat and long I get this:
Lat,long 40.714353,-74.005973
This shows up as New York City (which is not my location, but is my time zone). The New York City map also shows up on the venue edit page
dcb
Ah yes, the map automatically finds a location based on the timezone if it can. I’ve not tested it, but does the following work?
$venue_address = array_filter( eo_get_venue_address( $venue_id ) );
if( !empty( $venue_address ) ){
//Display map
}
It should only display a map if at least one of the address fields is not empty.
Stephen Harris
No, something in the array must have a value? The map still displays. However, if I do this it works:
$venue_address = array_filter( eo_get_venue_address( $venue_id ) );
if( !empty($venue_address['address']) || !empty($venue_address['city']) ||!empty( $venue_address['state']) || !empty( $venue_address['postcode']) || !empty( $venue_address['country'])){
//Display map
}
dcb