Custom Fields (Latitude, Longitude) not displaying map below post

Using Twenty Fifteen theme. I created a custom post type and added some lat/long custom fields. Then I installed/activated/setup Google Maps plugin and entered those 2 fields in the Google Maps setting.
Please review my screenshots and tell me if I'm doing something wrong.

And if I were to select "no" for automatically displaying the map, how WOULD I display it? I didn't see that as on option anywhere.

Also, I'm not using (and am not interested in using) CustomPress plugin.

  • Michael Bissett

    Hey @Clifford P, hope you're doing well today! :slight_smile:

    The only thing that seems up here is that "Associate the new map to post" is set to "No", I'd want to set that to "Yes", and then try updating a post that's got those custom fields filled out, so that the map gets associated with it.

    And if I were to select "no" for automatically displaying the map, how WOULD I display it? I didn't see that as on option anywhere.

    Depends on how you're wanting to display it here. :slight_smile:

    If you're wanting to just display it in that post, you could insert the shortcode for the map by using the add map icon next to the "Add Media" button (it's the icon that looks like a globe).

    If you're wanting to display it along with other markers in a widget though, you could use the Google Maps Widget that we provide (more on using that in the section "Adding your Google Map(s) to your sidebar" on the usage page).

    Hope this helps! :slight_smile:

    Kind Regards,
    Michael

  • Michael Bissett

    Hey @Clifford P,

    Sure thing, I've attached screenshots of my setup here, along with what I'm seeing on my test site.

    I'd like to ask though... given that you said this:

    No map shows up in the globe TinyMCE button or on the front-end post view.

    If you've got any other plugins enabled (aside from Google Maps & whatever it is you're using to provide the custom fields), could you try disabling them, and seeing if that helps? Sounds like there might be a conflict going on at your site.

    Kind Regards,
    Michael

  • Clifford P

    tyvm. It was helpful.

    I got everything setup just like yours (except Types instead of CustomPress) and it resulted in this:

    Notice: Undefined index: show_posts in /wp-content/plugins/wpmu_dev_maps_plugin/inc/class-agm-map-model.php on line 911

    I added this to my wp-config.php:

    define('WP_DEBUG_LOG', true);
    define('WP_DEBUG_DISPLAY', false);

    After reloading the post with the custom field coordinates, it generated the /wp-content/debug.log, which included this:

    [29-May-2015 21:15:57 UTC] PHP Notice: Undefined index: show_posts in /wp-content/plugins/wpmu_dev_maps_plugin/inc/class-agm-map-model.php on line 911
    [29-May-2015 21:15:57 UTC] PHP Stack trace:
    [29-May-2015 21:15:57 UTC] PHP 1. {main}() /index.php:0
    [29-May-2015 21:15:57 UTC] PHP 2. require() /index.php:17
    [29-May-2015 21:15:57 UTC] PHP 3. require_once() /wp-blog-header.php:16
    [29-May-2015 21:15:57 UTC] PHP 4. include() /wp-includes/template-loader.php:74
    [29-May-2015 21:15:57 UTC] PHP 5. get_template_part() /wp-content/themes/twentyfifteen/single.php:24
    [29-May-2015 21:15:57 UTC] PHP 6. locate_template() /wp-includes/general-template.php:171
    [29-May-2015 21:15:57 UTC] PHP 7. load_template() /wp-includes/template.php:477
    [29-May-2015 21:15:57 UTC] PHP 8. require() /wp-includes/template.php:503
    [29-May-2015 21:15:57 UTC] PHP 9. the_content() /wp-content/themes/twentyfifteen/content.php:35
    [29-May-2015 21:15:57 UTC] PHP 10. apply_filters() /wp-includes/post-template.php:230
    [29-May-2015 21:15:57 UTC] PHP 11. call_user_func_array:{/wp-includes/plugin.php:213}() /wp-includes/plugin.php:213
    [29-May-2015 21:15:57 UTC] PHP 12. AgmUserMaps->process_post_meta() /wp-includes/plugin.php:213
    [29-May-2015 21:15:57 UTC] PHP 13. AgmMapModel->autocreate_map() /wp-content/plugins/wpmu_dev_maps_plugin/inc/class-agm-user-maps.php:81

    After turning WP_DEBUG off, it didn't display any map.

    Screenshots of my setup:

  • Michael Bissett

    Hey @Clifford P,

    Took some digging, but I believe I've found the reason why you've been having issues. :slight_smile:

    As it turns out, Types adds it's own prefix to the custom fields, which you'll need to go to:

    Types -> Custom Fields Control

    In order to see (you'd need to check out the "Types Name" column for your custom field). In your case, you'd need to enter these as the latitude & longitude field names:

    wpcf-gf_geo_lat
    wpcf-gf_geo_long

    Once you do that, Google Maps should use the data entered in the fields. :slight_smile:

    Let me know if this helps please!

    Kind Regards,
    Michael

  • Michael Bissett

    Hey @Clifford P, thanks for your patience here! :slight_smile:

    Yep, I'm seeing that it's working properly with normal custom fields, as noted in the attached screenshots.

    I would like to ask though... have you tried creating a fresh post, and tried entering the latitude & longitude information into the custom fields there? If that doesn't work, what if you were to try creating new custom fields for use with Google Maps, just to see if that works?

    Please advise,
    Michael

  • Clifford P

    I changed the maps plugin to use 2 different fields, named from http://codex.wordpress.org/Geodata

    I edited an existing page that didn't have those 2 fields (these 2 fields weren't used by any post before) and it worked.

    Then I changed the map plugin settings to use the previous 2 fields I had entered and added it to that same single post that worked a second ago with the geodata fields, and it worked again.

    Since I was previously trying on a custom post type post (created by the Types plugin), I tried an existing one and it didn't work again, just like before.

    Since it didn't work again, I created a brand new post of this custom post type, added the custom fields, Published the new custom post type post, viewed it, and still no map, like the Page that worked.

    Maybe you/dev can try a fresh install, activate the free https://wordpress.org/plugins/types/ plugin, create a new custom post type, etc and see if you can get it working.

    tyvm for all the step-by-step help to make sure we both stay on the same page!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.