Home › Forums › Front-end Issues › Enqueue Google Map › Reply To: Enqueue Google Map
You could try mine I guess…
function rt_load_plugin_css () {
$mapkey; //replace variable with your actual ke
$mapkeyurl = 'https://maps.googleapis.com/maps/api/js?key='.$mapkey;
$dir_url = get_template_directory_uri() . '/js/acf-map.js';
wp_enqueue_script( 'map_script', $dir_url, array('jquery'), '1.0', true );
wp_enqueue_script( 'googlemap', $mapkeyurl, true);
}
add_action ('wp_enqueue_scripts', 'rt_load_plugin_css');
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.