WordPress.org

Ready to get started?Download WordPress

Forums

All-in-One Event Calendar
[resolved] Using the ai1ec Google Maps feature in a custom theme (2 posts)

  1. CatchThePigeon
    Member
    Posted 4 months ago #

    I have had to use a custom theme design to operate my events platform and every now and then like to put some new features on the website myself.

    I have been trying to implement a Google Maps div under the event information using some of the Code I found whilst rummaging around in the Vortex theme.

    Namely:

    <?php if ( $map ) : ?>
    <div class="gmaps"><?php echo $map; ?></div>
    <?php endif; } ?>

    With a few CSS tweaks I have it looking ok but when you click to view map only a tiny section is loaded and the parameters seem to be wrong when you scroll around as most of it ends up disappearing on the right after you drag it across.

    See here:
    Before
    https://www.dropbox.com/s/348ofov10mk1zlc/Click%20to%20View%20Map.png

    After:
    https://www.dropbox.com/s/zxtlgpjjxu9v3si/Once%20Clicked.png

    The general consensus on this is to use
    google.maps.event.trigger(MapInstance,'resize')
    however I've put it in as scripts and (to test it) as a button on the page and it doesn't work.

    Can anyone see what I'm doing wrong - happy to pastebin some code if anyone wants.

    I have not implemented this into the site yet only on my virtualserver so cannot provide a link to show unfortunately.

    https://wordpress.org/plugins/all-in-one-event-calendar/

  2. CatchThePigeon
    Member
    Posted 2 months ago #

    OK, no joy from doing it this was so did this.

    $address = substr(trim(str_ireplace('<br />',', ',$location)),0,-1);

    Then

    <iframe width="205" height="189" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/place?q=<?php echo $address;?>&key=[====GOOGLE API KEY =====]"></iframe>

    You can easily get an API key from google if you have any kind of google account.

Reply

You must log in to post.

About this Plugin

About this Topic