Support

Home Forums Event Espresso Premium Google Map Blank

Google Map Blank

Posted: February 6, 2014 at 8:19 am

Viewing 12 reply threads


Josiah Cole

February 6, 2014 at 8:19 am

I am using custom post types, and the single-espresso_event.php template. I changed $show_venue to 1 and added <?php echo $event_venue; ?> to my template.

The map shows but is simple a blue/square / empty and does not show the venue address entered.

We need the Google Map to display for all events, so I’d like to have it coded into the template instead of using a shortcode.

Also, the link to Map and Directions leads to this: http://maps.google.com/maps?q=


Josiah Cole

February 6, 2014 at 8:35 am

I searched the forums some more and found this code:

<?php echo do_shortcode("[ESPRESSO_VENUE show_map_image='true' map_image_wrapper='google-map' map_w='650' map_h='300']"); ?>

But that doesn’t work at all (nothing shows)


Josh

  • Support Staff

February 6, 2014 at 11:31 am

Hi Josiah,

It’s missing the event ID parameter.

https://eventespresso.com/wiki/shortcodes-template-variables/#venue


Josiah Cole

February 11, 2014 at 9:14 am

I don’t have preset venues, for each event there’s potentially a different venue. How do I add map code to the template for single event posts so that it uses the Physical Location?


Josh

  • Support Staff

February 11, 2014 at 11:55 am

Hi there,

The code you posted earlier should work if you add an event Id parameter.


Josiah Cole

February 11, 2014 at 12:19 pm

Ok I updated the code to the following (removing some of the parameters to simplify it) <?php echo do_shortcode('[ESPRESSO_VENUE event_id="'.$event_id.'" ]'); ?>

But I have the same result.


Josh

  • Support Staff

February 11, 2014 at 12:48 pm

Is $event_id defined in your template?


Josiah Cole

February 11, 2014 at 1:03 pm

I’m using mostly the stock single-espresso-event.php template which contains this code $event_id = get_post_meta($post->ID, 'event_id', true);


Josh

  • Support Staff

February 11, 2014 at 1:37 pm

The code is working for me, but it may be the address entered into the venue manager is affecting it. You could try experimenting with other addresses to see if that’s the case.


Josiah Cole

February 11, 2014 at 2:13 pm

I checked 7 different events, each of which have address1, city, state and zip code entered. All have a blank map and a black Google Map query. I even checked the custom post types created to make sure the meta fields contained the same information.

Can I send you a PM with my URL/WP info?


Sidney Harrell

February 11, 2014 at 2:24 pm

You can fill out the form here (please include ftp login creds to expedite things if any debugging is needed), send it care of me (sidney). Please be aware that we cannot make any guarantees as to response time. We are extremely busy doing support with the launch of the EE4 beta. We can only guarantee timeliness with the purchase of a support token.


Josh

  • Support Staff

February 11, 2014 at 2:32 pm

@Josiah

Are you using the Venue Manager? If not, that may be why the maps aren’t working. The Venue Manager lets you enter the venue details in a venue manager, then you select the venue when you create/edit an event.


Josiah Cole

February 12, 2014 at 5:44 am

I am not using the venue manager. My client has many events and simply enters a physical address for each event. I’d like the map to use this address as it isn’t feasible to enter venues separately.


Josh

  • Support Staff

February 12, 2014 at 6:54 am

Hi Josiah,

For this case you’ll need to use some of the address variables, and add one two more to make the map because the shortcode will not work in this case.

Here are a few new variables you can add to the template to a place after the standard address variables:

// get the zip
$event_zip = get_post_meta($post->ID, 'event_zip', true);
// build the map
$google_map_image = espresso_google_map_link(array('id' => $event_id, 'map_image_class' => 'class="gmap"', 'address' => $event_address, 'city' => $event_city, 'state' => $event_state, 'zip' => $event_zip, 'country' => $event_country, 'text' => '', 'type' => 'map', 'map_h' => '400', 'map_w' => '400'));

Then you can use these new variables in later in the template:

<div>Venue address: <?php echo $event_address; ?></div>
<div><?php echo $google_map_image; ?></div>
Viewing 12 reply threads

The support post ‘Google Map Blank’ 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