WordPress.org

Support

Support » Plugins and Hacks » WP Geo » WP Geo with Google Maps v3 – Please help by testing…

WP Geo with Google Maps v3 – Please help by testing…

Viewing 15 replies - 1 through 15 (of 28 total)
  • Hi Ben,

    I’m not able to get the map to show up, either on custom posts or all posts on a map. Code is in the source, but no map is shown. You can check my test page here: Test

    Any hints?

    Something is missing, I get ‘ReferenceError: Can’t find variable: google’

    Ok, so basically google api script was missing… If I put it in manually
    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=MYKEY&sensor=T/F"></script>
    with my api key, I get map shown for couple of seconds, and then it just disappears… ???

    btw. WP 3.5.1 (if it means anything here :-))

    ps. Would you consider using async load of script?

    function loadScript() {
            var script = document.createElement('script');
            script.type = 'text/javascript';
            script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&' +
                'callback=initialize';
            document.body.appendChild(script);
          }
    
          window.onload = loadScript;

    https://google-developers.appspot.com/maps/documentation/javascript/examples/map-simple-async

    Plugin Author Ben Huson

    @husobj

    @roni Thanks for the feedback.
    Were you able to get the maps showing OK on normal posts/pages without having to add in the code manually?

    I will consider added async in the future but for now if you want to use that best just to dequeue the main script and include like that yourself.

    Hi Ben,

    I managed to get it working. Removed manual script. It obviously took some time for Mr. G to figure out I enabled maps API v3 🙂

    Now, all is fine except for sidebar widget which does not respect the zoom level… It shows markers as expected, just the map is fully zoomed out…

    As for async loading, I might do that for now 😉

    Great plugin btw 🙂
    Thank you!

    Plugin Author Ben Huson

    @husobj

    @roni Thanks for your feedback, very helpful.

    Hi Ben,

    Sorry for posting here, if you want I can use contact form from your site, but suppose this might help others too 🙂

    I’m trying to integrate map with Gravity forms. The code used to work, but now I get error:

    Fatal error: Call to a member function get_dom_id() on a non-object in /home/content/44/8697844/html/summer/wp-content/plugins/WP-Geo-3.2.dev/includes/wp-geo.php on line 768

    Any hints?

    Using this post from Gravity support.

    Plugin Author Ben Huson

    @husobj

    Ah, the functionality you are using there was original intended just for the admin.
    I have split out admin functionality to only load in the admin to reduce overhead.

    You could try loading the admin functionality manually like this:
    (not I have not tested this)

    function my_load_wpgeo_admin() {
       global $wpgeo;
       include_once( WPGEO_DIR . 'admin/admin.php' );
       $wpgeo->admin = new WPGeo_Admin();
    }
    add_action( 'plugins_loaded', 'my_load_wpgeo_admin' );

    Nope, still no luck, same error.
    Tried your way, and tried to include just the file in my code since I want to it be accessible to all, not just admin.

    You can take a look at whole chunk of code at Pastebin

    Actual page with form for test.

    Plugin Author Ben Huson

    @husobj

    Where you do this in line 20:
    require_once( WP_PLUGIN_DIR . '/WP-Geo-3.2.dev/wp-geo.php' );

    You should be able to write it like this instead (better not to write the folder name):
    require_once( WPGEO_DIR . 'wp-geo.php' );

    Try adding the following immediately after that:
    include_once( WPGEO_DIR . 'admin/admin.php' );

    I’ll also try to recreate a test later

    Tried, I think all those combinations, but all give the same

    Fatal error: Call to a member function get_dom_id() on a non-object in /home/content/44/8697844/html/summer/wp-content/plugins/WP-Geo-3.2.dev/includes/wp-geo.php on line 768

    Hi Ben,
    Another issue I’m having. Trying to get map for custom post in single template file.
    I can not seem to get marker for current post to show on the map.

    If I try wpgeo_map( array('width' => 630,'height' => 300) ); I get map without marker centered with default WPGeo settings.
    Same goes for get_wpgeo_map( array('width' => 630,'height' => 300) );

    If I try wpgeo_post_map(); no map shows up…
    If using echo do_shortcode("[wp_geo_map]"); no map shows up…

    Marker does show up in widget for that post (tried all combinations with and without widget on single post…

    Trying to echo wpgeo_longitude(); and echo wpgeo_latitude(); does print out correct values for current post…

    You can see at the bottom of this page a map that is zoomed and centered according to global WP Geo settings, and uder the map I printed current post wpgeo_longitude(); and wpgeo_latitude();

    Another issue:
    WP Geo widget does not respect zoom level. It is fully zoomed out!

    Another interesting bug that I just found out…
    The page that shows mash-up map with all points shows up ok as long as I have WP Geo widget in sidebar. If I remove widget from sidebar, map does not show up.
    While the widget is in sidebar, on the mash-up map page it does not appear in sidebar, while main map is perfect… :confused:

    Code that I use to show mash-up map is:

    function gmap_loop() {
    	wpgeo_map( array(
    		'post_type' => 'accommodation',
    		'posts_per_page' => -1
    		) );
    }

    Sorry to bomb you with all of this, but I really like the plugin functionality and would love to make it all work with API v3 🙂

    To sum it up:
    1. issue is integration with Gravity forms
    2. issue is marker to show on single posts
    3. issue is with mash-up map

    I think I found a problem for 2nd issue, in head of generated page WP Geo script is generated with post details, but first if statment says if(document.getElementById("wpgeo_map_20_1")), but the actual map id is wpgeo_map_id_1_1
    I don’t know how to fix this and would not like to mess up the plugin code, but it should be pretty simple for you 😉

    I studied a bit issue #3 regarding mash-up map on a page (called in template via wpgeo_map).
    Checking WP Geo settings to show maps on pages resolves issue related to widget, meaning map shows up on a page as expected, with or without widget in sidebar. Ok.
    This solution is kind of not nice, since if this setting is checked, WP Geo (google maps) code appears on all pages regardless if there is a map on it or not.
    But, also unchecking checkbox to show map on Pages in settings = also big part of WP Geo code appears on all pages!

    Probably the conditions logic is mixed up a bit 🙁
    My suggestion is to make a function or call that we can execute just where we want to. for example on my current project I need maps on custom post type posts, mash-up map on home page and one large mash-up map on dedicated map page. So no reason for wp geo to put all the google map script in any other pages / posts.

Viewing 15 replies - 1 through 15 (of 28 total)
  • The topic ‘WP Geo with Google Maps v3 – Please help by testing…’ is closed to new replies.
Skip to toolbar