WordPress.org

Ready to get started?Download WordPress

Forums

WP Geo
[resolved] map not showing in admin (7 posts)

  1. Pat Harvey
    Member
    Posted 1 year ago #

    I seem to be having a problem where the map part of wp-geo is not showing on my admin pages - all I see is a space where the map should be and the message Loading Google map, please wait....

    This was working before, but has now stopped - and I can't think of any changes that have been made that could have caused this.

    Using firebug I can see the following errors in the console in case that helps indicate the issue (I have tried using firefox and IE, in case it was a browser issue).

    ReferenceError: GUnload is not defined
    jQuery(window).unload( GUnload );
    post.p...on=edit (line 126)
    ReferenceError: GBrowserIsCompatible is not defined
    if (GBrowserIsCompatible() && document.getElementById("wp_geo_map"))
    post.p...on=edit (line 53)

    The maps show fine on the published pages.

    Many thanks for any suggestions.

    Patch

    http://wordpress.org/extend/plugins/wp-geo/

  2. Ben Huson
    Member
    Plugin Author

    Posted 1 year ago #

    Hi PatchH,

    It sounds like it probably isn;t loading the Google Maps Javascript in your admin for some reason.

    "...was working fine before..." - before what?

    Have you upgraded WP Geo, upgraded WordPress, upgraded/installed another plugin or theme?

  3. Pat Harvey
    Member
    Posted 1 year ago #

    Hi Ben, thanks for the quick response. You hit the nail on the head regarding not loading the Javascript. That was my mistake.
    I only need the map on a particular custom page type, and it was conflicting with another map that was on the other pages - so I had made an edit to the wp-geo/includes/wp-geo.php

    It hadn't occurred to me that this would have an effect on the admin pages too.

    Sorry to have wasted your time!

    All the best

    Patch

  4. Ben Huson
    Member
    Plugin Author

    Posted 1 year ago #

    No worries.
    What bit did you need to hack?
    I'll try to provide a filter so you can do this from your theme's functions.php in future so you don't have issues upgrading.

  5. Pat Harvey
    Member
    Posted 1 year ago #

    Hi, it would be great for me if you could add this feature - as you say it would make upgrades simpler.

    My problem was:

    I have a couple of custom page types, and on one of those pages I use the wp-geo map.
    On the other pages I have another google map, but something in the wp-geo code that was present in the page header seemed to prevent the other map from showing.

    My solution was to prevent the wp-geo being included on the other pages. To do this I added a variable to the header of the template used to show the particular custom page type (eg $my_customPage) and gave it a value.

    I then modified a function within the includes/wp-geo.php file and checked for this variable (and now checked to see if it is an admin page too!) and put this around the contents of the function.

    function includeGoogleMapsJavaScriptAPI() {
         if(($my_customPage == 'noGeoMap')||(is_admin())){

    And this fixed the problem for me.

    I guess an option in the admin section to "include wp-geo in all pages/selected custom pages/posts/categories" etc would work for me. But not sure how easy that would be to implement at your end.

    Thanks for expressing the interest though,

    All the best

    Patch

  6. Ben Huson
    Member
    Plugin Author

    Posted 1 year ago #

    The next version of the plugin will have a filter called 'wpgeo_show_maps'.

    You'll be able to hook into this filter to return true/false depending on wether you need Google Maps to be loaded on the page or not.

    It basically overrides the includeGoogleMapsJavaScriptAPI() function and a few other things.

  7. Pat Harvey
    Member
    Posted 1 year ago #

    excellent Ben, I'll look out for that in the next upgrade of wp_geo

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic