Last active
April 13, 2016 09:24
-
-
Save Fitoussi/b0552acc6a2d8a2d3e549ef29ff32d24 to your computer and use it in GitHub Desktop.
Apply Google Places Address Autocomplete to an input field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function gmw_include_google_places_api() { | |
| //register google maps api if not already registered | |
| if ( !wp_script_is( 'google-maps', 'registered' ) ) { | |
| wp_register_script( 'google-maps', ( is_ssl() ? 'https' : 'http' ) . '://maps.googleapis.com/maps/api/js?libraries=places&sensor=false', array( 'jquery' ), false ); | |
| } | |
| //enqueue google maps api if not already enqueued | |
| if ( !wp_script_is( 'google-maps', 'enqueued' ) ) { | |
| wp_enqueue_script( 'google-maps' ); | |
| } | |
| } | |
| add_action( 'wp_enqueue_scripts', 'gmw_include_google_places_api' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment