• Resolved Mario Beach

    (@mariobeach)


    Any way to get it to work with fields in the admin post edit screens?

    I tried adding it to admin_enqueue_scripts but it must be missing something else as it is not triggered for the ACF field I added the ID for. I think it would be a nice feature to be able to use it in the backend too.

    add_action('admin_enqueue_scripts', 'simple_address_autocomplete_enqueue_google_maps_api_key', 10);
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Raza Khadim

    (@razakhadim)

    @mariobeach not really aimed for ACF but it should work. You will have to localize the script as well. Add this to your functions.php or through code snippet plugin:

    function enqueue_simple_address_autocomplete() {
          // Enqueue the necessary scripts for Simple Address Autocomplete
        wp_enqueue_script('simple_address_autocomplete_js_scripts', plugins_url('simple-address-autocomplete/public/js/simple-address-autocomplete-public.js'));
    	wp_localize_script('simple_address_autocomplete_js_scripts', 'simple_address_autocomplete_settings_vars', array(
    			'simple_address_autocomplete_google_maps_api' => get_option('simple_aa_options_google_maps_api_key'),
    			'simple_address_autocomplete_country_selected' => get_option('simple_aa_options_country', 'option'),
    			'simple_address_autocomplete_form_field_ids' => get_option('simple_aa_options_field_ids'),
    			'simple_address_autocomplete_bias_coordinates' => get_option('simple_aa_options_bias_coordinates'),
    			'simple_address_autocomplete_restriction_type' => get_option('simple_aa_options_restriction_type'),
    		));
    }
    
    add_action('admin_enqueue_scripts', 'enqueue_simple_address_autocomplete');

    Also, when testing I noticed a bit of lag with ACF fields. Maybe couple of clicks but did work. Maybe the site I tested is slow or ACF when working with this plugin.

    I hope this helps, let me know if there are any further issues.

    Thanks

    Plugin Author Raza Khadim

    (@razakhadim)

    @mariobeach hope this was resolved. I am going to close it for now but if there are any issues let me know. Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Admin post edit form’ is closed to new replies.