Google Map and Map links

Home Forums Calendar Products Events Calendar PRO Google Map and Map links

Viewing 15 posts - 1 through 15 (of 23 total)
  • Author
    Posts
  • #1153810
    Stuart
    Participant

    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

    #1153878
    Nico
    Member

    Hey 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,
    Nico

    #1154002
    Stuart
    Participant

    Hi 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,
    Stuart

    #1154626
    Nico
    Member

    Thanks 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,
    Nico

    #1154799
    Stuart
    Participant

    Thanks 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,
    Stuart

    #1155828
    Nico
    Member

    Hey 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,
    Nico

    #1155986
    Stuart
    Participant

    Hi 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,
    Stuart

    #1156005
    Stuart
    Participant

    Hi 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!
    Stuart

    #1156552
    Nico
    Member

    Hey 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,
    Nico

    #1157089
    Stuart
    Participant

    Hi 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,
    Stuart

    #1158351
    Nico
    Member

    This reply is private.

    #1158447
    Stuart
    Participant

    This reply is private.

    #1159503
    Nico
    Member

    This reply is private.

    #1159563
    Stuart
    Participant

    This reply is private.

    #1160092
    Nico
    Member

    This reply is private.

Viewing 15 posts - 1 through 15 (of 23 total)
  • The topic ‘Google Map and Map links’ is closed to new replies.