Home › Forums › Calendar Products › Events Calendar PRO › Google Map and Map links
- This topic has 23 replies, 4 voices, and was last updated 7 years, 6 months ago by Stuart.
-
AuthorPosts
-
August 19, 2016 at 12:36 pm #1153810StuartParticipant
Hi,
I have two issues.
1) In the List view of my events, I would like for the map to appear. Currently, only a link to the map appears; You can this here:
http://develdiscoversamuel.com/events/list/2) At the event level, the map does appear, but it’s not a link to a large map. How can I achieve that?
You can see that here: http://develdiscoversamuel.com/event/first-sunday-with-samuel-2016-09-04/Thanks for your help!
Stuart
August 19, 2016 at 3:32 pm #1153878NicoMemberHey Stuart,
Glad to help you out on this issue as well!
1) In the List view of my events, I would like for the map to appear. Currently, only a link to the map appears; You can this here:
http://develdiscoversamuel.com/events/list/You can paste the snippet below in your theme’s (or child theme’s) functions.php file to display the map in list view. Please note that this might not play well with your theme, it’s just a code sample and you can reach out to the theme author on how to tweak this:
/* Tribe, show map in list view */
function tribe_print_map_in_list_view ( ) {// bail if not in list view
if ( !class_exists('Tribe__Events__Embedded_Maps') || !function_exists('tribe_is_list_view') || !tribe_is_list_view() ) return false;$maps = Tribe__Events__Embedded_Maps::instance();
echo $maps->get_map( null, null, null, false );
}
add_action ( 'tribe_events_after_the_meta', 'tribe_print_map_in_list_view' );
2) At the event level, the map does appear, but it’s not a link to a large map. How can I achieve that?
You can see that here: http://develdiscoversamuel.com/event/first-sunday-with-samuel-2016-09-04/This is something you can define per venue with the setting ‘Show Google Maps Link’. You can define this when you create a new event (https://cloudup.com/cGrRDQGeAaW) or by editing an existing venue (https://cloudup.com/c5mpZfRCiTu). If the setting is checked but the link still doesn’t show up, try switching to a WordPress default theme (like Tweenty Sixteen) and re-check.
Please let me know if the above helps,
Best,
NicoAugust 20, 2016 at 6:17 am #1154002StuartParticipantHi Nico,
I tried both and they didn’t work. 🙁
The snippet seemed to break things and no pages would load on my site.
I have checked those boxes for Google Maps and it still doesn’t appear as a map on the event page. I tried the theme 2014 and it, too, only displayed a Google Map link.
On the event’s actual page, the map does appear, but it’s not link. This is also true for the 2014 theme.
Any other suggestions on how to fix this?
Thanks,
StuartAugust 22, 2016 at 7:23 pm #1154626NicoMemberThanks for following up Stuart!
I just re-tested the snippet and I could confirm it’s working for me (in 2016 theme). Can you please try to copy the snippet to a plain text editor and then copy it over once again to your theme’s (or child theme’s) functions.php file? Sometimes copying directly from the reply can cause unexpected errors. Also, if you switch to 2016 or 2014 theme please note you will have to copy/paste the snippet once again to the active theme’s functions.php file!
Have you configured a Google Map API for the site (Setting up your Google Maps API)? Do you see any JavaScript errors in the browser console related to the GMaps API (https://codex.wordpress.org/Using_Your_Browser_to_Diagnose_JavaScript_Errors#Step_3:_Diagnosis)?
I’m trying it out in 2016 theme, it would be great if you could try in it as well just to be sure we are on the same page.
Please let me know about it,
Best,
NicoAugust 23, 2016 at 8:13 am #1154799StuartParticipantThanks Nico for hanging with me on this!
I copied and pasted the code in Text Wrangler. Then copied and pasted it in my child theme’s functions.php file.
I tested it with the 2016 theme and no map was displayed (only a link to the map). See attached screenshot.
In my child theme (I’m using the Avada theme), it did display the map! But, it didn’t put it where I want it to go. Also, there’s still a box with a link that says “Google Map”. That’s redundant. See second screenshot.
In a perfect world, I’d like that smaller rectangle space (with the Google Map link) to contain the actual map and for the map to be a link to a larger map.
Any and all suggestions on achieving this are greatly appreciated.
Cheers,
StuartAugust 25, 2016 at 8:49 am #1155828NicoMemberHey Glad to hear this is working with your theme Stuart 🙂
I find it rather strange that it doesn’t work on the default theme 2016. But if it’s working with your theme, then I guess we are good on that point.
To modify the place this is showing you’ll need to create a template override of the file: [avada-theme]/tribe-events/list/single-event.php in the child theme. Instead of using the action to fire this function you’ll have to add the function call in the template. So remove the add action line from the snippet:
/* Tribe, show map in list view */
function tribe_print_map_in_list_view ( ) {// bail if not in list view
if ( !class_exists('Tribe__Events__Embedded_Maps') || !function_exists('tribe_is_list_view') || !tribe_is_list_view() ) return false;$maps = Tribe__Events__Embedded_Maps::instance();
// params below are: $post_id, $width, $height, $force_load, feel free to change the width and height params
echo $maps->get_map( null, null, null, false );}
And once you have the theme override in place in your child theme, just place a call to this function were you want this to show. For example, this a piece of /list/single-event.php:
<!-- Event Meta -->
<?php do_action( 'tribe_events_before_the_meta' ) ?>
<div class="tribe-events-event-meta">
<?php if ( function_exists('tribe_print_map_in_list_view') ) tribe_print_map_in_list_view(); ?>
Please let me know if this helps out,
Best,
NicoAugust 25, 2016 at 11:52 am #1155986StuartParticipantHi Nico,
I followed the steps for adding the first bit of code and it’s not working well.
You can see it here:
http://develdiscoversamuel.com/events/I didn’t add the second piece of code. Would that go into the same single-event.php file in my child theme?
Thanks,
StuartAugust 25, 2016 at 12:20 pm #1156005StuartParticipantHi Nico,
I have another question that might be easier.
How can I lessen the padding above and below the title “Upcoming Events” on the events page? It takes up more space than I would like for it to.
Thanks for your help!
StuartAugust 26, 2016 at 3:06 pm #1156552NicoMemberHey Stuart,
I didn’t add the second piece of code. Would that go into the same single-event.php file in my child theme?
Yeap, that should go in the single-event file, just the line below (the other lines were intended to give you some context):
<?php if ( function_exists('tribe_print_map_in_list_view') ) tribe_print_map_in_list_view(); ?>
How can I lessen the padding above and below the title “Upcoming Events” on the events page? It takes up more space than I would like for it to.
For this you can add the following code to the child theme stylesheet or via Simple Custom CSS plugin:
#tribe-events-bar {
margin-bottom: 20px;
}.fusion-events-before-title {
margin-bottom: 0;
}
Please let me know if this helps you out,
Best,
NicoAugust 29, 2016 at 8:42 am #1157089StuartParticipantHi Nico,
The CSS override worked great for the Upcoming Events. Thanks!
But, I still can’t get the map to appear in the box on the event list page. Nor can I get the map to be a link on the event page. 🙁
Not sure what I’m doing wrong.
Do you want to login to my site and have a look around? If so, I can send you the credentials in a private message.
Many thanks,
StuartAugust 31, 2016 at 11:07 am #1158351NicoMemberThis reply is private.
August 31, 2016 at 1:15 pm #1158447StuartParticipantThis reply is private.
September 2, 2016 at 1:48 pm #1159503NicoMemberThis reply is private.
September 2, 2016 at 5:11 pm #1159563StuartParticipantThis reply is private.
September 5, 2016 at 12:00 pm #1160092NicoMemberThis reply is private.
-
AuthorPosts
- The topic ‘Google Map and Map links’ is closed to new replies.