• Hello,

    first of all thank you for the great plugin.

    I try to use your plugin on a site, which loads posts via ajax. But the map is not showing.

    Here is what i did so far:

    I entered the short code in the post, but it returns empty.

    I also tried to execute the short code in my template by:
    <?php echo do_shortcode(‘[google_maps id=”884″]’); ?>
    No success.

    Also the scripttag, which is inserted by the plugin is empty.
    <script type=”text/javascript”>/* <![CDATA[ */var gmb_data = [];/* ]]> */</script>

    I tried the shortcode on another site, which isn’t loaded via ajax and it works.

    Do I have to reinitiate the plugin after the Ajax call? Or what am I doing wrong?

    Thank you

    https://wordpress.org/plugins/google-maps-builder/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Fesch

    (@fesch)

    Anyone?

    Plugin Author Devin Walker

    (@dlocc)

    Hey there sorry for the late reply. The plugin hasn’t been tested with an AJAX site implementation yet so I’m not sure what I can recommend that would help. I would need to see the site theme code and how it’s loading data and then determine the best way that Google Maps Builder can output the maps appropriately.

    Thread Starter Fesch

    (@fesch)

    Thank you for your response.

    This is a simplified version of the functions, which is called via Ajax.

    $post_id = $_POST['id'];
    
      global $post;
      $post = &get_post($post_id);
      setup_postdata( $post );
      echo include(locate_template('content-single.php'));

    Inside the template file the content of the post is returned by

    <?php the_content(); ?>

    As I mentioned in my first post, I tried to execute the map shortcode inside my template file after: the_content().

    By echo do_shortcode('[google_maps id="884"]');

    But it doesn’t work.

    Thank you

    Thread Starter Fesch

    (@fesch)

    Maybe you can give me just a little hint where to start? Is it possible to get the content of the map by the map id? Just like the_content() of a reuglar post?

    I would really appreciate any help.

    Thank you

    Plugin Author Devin Walker

    (@dlocc)

    Hmm, to be honest I’m not sure without getting hands on and debugging.

    Thread Starter Fesch

    (@fesch)

    No problem. I solved the problem by using an iframe for the map. Not the best solution, but it works.

    Just one last question:
    Is it possible to display a list of all locations next to the map?

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Map and Ajax’ is closed to new replies.