-
AuthorPosts
-
October 10, 2019 at 9:57 am #1146796
We’re using a Google Maps field from Advanced Custom Fields to select a location when creating a new post (custom post type).
The suggestions for an address don’t show up when using Enfold. We’re using an Enfold child theme, but the error persists when switching to Enfold. Works just fine when changing to twentynineteen theme.
WP version is 5.2.3 and Enfold is 4.6.3.1Any ideas to what may cause this?
October 14, 2019 at 6:17 am #1147717Hey forde,
Thank you for the inquiry.
The theme’s map scripts are probably in conflict with the plugin’s. Where can we see the issue?
You can disable the theme’s map element from the Enfold > Performance > Disable Template Builder Elements panel. Set the “Disabling of template builder elements” to the third option, then check the “Google Map Element” to disable it. Or use the “avf_load_google_map_api_prohibited” filter to prevent the map scripts from loading.
Best regards,
IsmaelOctober 14, 2019 at 11:04 am #1147798Thank you for your reply, unfortunately I had no success disabling the theme’s map element. I tried both methods you described.
The problem is occuring in the back-end when we’re creating a new post with a custom post type.
I used a command from ACF’s javascript library, ‘ acf.isset(google, ‘maps’, ‘places’, ‘Autocomplete’) ‘,
which returned false when Enfold is activated – meaning Autocomplete is not activated. Same command returns true when twentynineteen is active). Somehow Enfold is turning off the autocomplete.No message about any javascript conflicts, if I manually enter the address and press the search button the marker is placed at the correct location (this is probably not the Autocomplete API though).
All APIs are activated for this project in the Google Cloud Platform ConsoleOctober 15, 2019 at 2:47 pm #1148099Hi,
We are not really sure how you are using the scripts. Can you give us a link to the documentation? It would be wise to contact the plugin authors for additional help.
Best regards,
IsmaelOctober 16, 2019 at 2:19 pm #1148467I too am having the exact same issue. It was working before but seems to have stopped.
If I remove the api key from enfold settings, the backend ACF map does not load.
I have tried both methods in my child’s functions.php from here: https://www.advancedcustomfields.com/resources/google-map/
The map will not show at all if Enfold does not have it’s API field filled in.
I tried switching to twenty nineteen, checked the edit post and I got the google maps cannot load message, then I added the exact same code I added to my enfold child functions.php to the functions.php in twenty nineteen, went back to post edit the map loads and suggestions come in.
This means to me that enfold is ignoring the ACF inclusion completely and only counting it’s own.
I have even tried the disabling the enfold maps as described here: https://kriesi.at/support/topic/disable-google-maps-api-call-in-backend/#post-308708
But this does not work either, it still behaves the exact same way, even with this disable maps script, if I pop the API key into Enfolds settings, it loads a map but no autocomplete, I take it away, I get nothing. I have been running around in circles for 2 days on this now.
I would really appreciate some help.
October 18, 2019 at 6:12 am #1149112Hi,
Thank you for following up.
Do you see any errors in the console when you’re on the ACF map interface or settings? It is possible that the map API is loaded twice. If that is the case, then you can use the following snippet to disable any map related scripts added by the theme.
add_filter('avf_gmap_vars', 'avf_gmap_vars_disable', 10, 1); function avf_gmap_vars_disable($map) { $map = null; return $map; } add_filter('avf_load_google_map_api_prohibited', 'avf_load_google_map_api_prohibited_true', 10, 1); function avf_load_google_map_api_prohibited_true($prohibited) { if( is_admin() ) $prohibited = true; return $prohibited; } add_action('init', 'ava_deregister_gmaps', 9999); function ava_deregister_gmaps() { if(is_admin()) { wp_deregister_script( 'avia-google-maps-api' ); wp_deregister_script( 'avia_google_maps_front_script' ); wp_deregister_script( 'avia_google_maps_api_script' ); wp_deregister_script( 'avia_google_maps_widget_admin_script' ); } }
You can also try this filter.
add_filter( 'avf_load_google_map_api', '__return_false' );
Best regards,
IsmaelOctober 21, 2019 at 2:48 pm #1149882No errors in the console.
The third function (ava_deregister_gmaps) you suggested fixed the problem. Thank you for the help.
October 21, 2019 at 5:42 pm #1149918Confirmed! (ava_deregister_gmaps) sorted it for me too.
thanks
October 22, 2019 at 5:58 pm #1150241Hi dannhanks,
Glad you got it working for you! :)
If you need further assistance please let us know.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.