Posted: 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 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= |
|
I searched the forums some more and found this code:
But that doesn’t work at all (nothing shows) |
Hi Josiah, It’s missing the event ID parameter. https://eventespresso.com/wiki/shortcodes-template-variables/#venue |
|
|
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? |
Hi there, The code you posted earlier should work if you add an event Id parameter. |
|
|
Ok I updated the code to the following (removing some of the parameters to simplify it) But I have the same result. |
Is $event_id defined in your template? |
|
|
I’m using mostly the stock single-espresso-event.php template which contains this code |
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. |
|
|
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? |
|
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. |
@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. |
|
|
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. |
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> |
|
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.