WordPress Google Maps in Custom Theme

Enqueue your script and use wp_localize_script to pass data. function wpd_scripts() { wp_enqueue_script( ‘wpd_script’, get_stylesheet_directory_uri() . ‘/js/script.js’, null, null, false ); wp_localize_script( ‘wpd_script’, ‘WPD’, array( ‘stylesheet_dir’ => get_stylesheet_directory_uri() ) ); } add_action( ‘wp_enqueue_scripts’, ‘wpd_scripts’ ); You can then use WPD.stylesheet_dir in your script to get the value you set in PHP. var marker_url = WPD.stylesheet_dir … Read more

Geocoding an Exploded Custom Field Array

This isn’t a complete answer, but a couple of bits of advice – Don’t geocode the addresses on front-end requests, it’s a waste of cycles. An address only needs to be geocoded once, then you can store the lat/lon data with your post meta. Use a save_post hook to do the geocoding when the post … Read more

Integrating PHP into Javascript to display map markers with Google API

Update 2: <?php $storeData = []; $args = [‘post_type’ => ‘store’]; $loop = new WP_Query($args); foreach ($loop->posts as $post) { $storeData[] = [ ‘title’ => apply_filters(‘the_title’, $post->post_title), ‘lat’ => types_render_field(‘lat’, [‘output’ => ‘raw’]), ‘long’ => types_render_field(‘long’, [‘output’ => ‘raw’]), ]; } wp_localize_script(‘jquery-core’, ‘storeData’, $storeData); ?> <?php get_header(); ?> <!– Row for main content area –> … Read more

How can I run shortcode after click with ajax

You should try to replace the following jQuery part: action: ‘process_shortcode_on_tab_click’ with this one: action: ‘process_shortcode_on_tab_click_action’ to match your wp_ajax_process_shortcode_on_tab_click_action and wp_ajax_nopriv_process_shortcode_on_tab_click_action actions. Check for example the Codex on how to name the custom wp_ajax_$youraction hook.

Integrating Google Maps with custom marker and hover?

Mappress allows for custom markers, but you need to pay for the pro version. http://wordpress.org/extend/plugins/mappress-google-maps-for-wordpress/ Google Map Shortcode also supports custom markers in a shortcode http://wordpress.org/extend/plugins/google-map-shortcode/ Getting custom overlays on Google maps is actually pretty easy, you can read the docs here if you choose to work directly with the API, http://code.google.com/apis/maps/documentation/javascript/overlays.html There are plenty … Read more

WordPress Google Maps

There is one and two really interesting ones at the general plugin database. Slightly different with their layout options, but they both take data input (coordinates and what-have-you) in plenty of formats. hope that helps, J

Google Maps not displaying in wordpress using Google Maps Javascript API

I was able to get this working after a bit of fiddling. Give the #map-canvas element a height (you can do this in CSS): <div id=”map-canvas” style=”height:500px”></div> Add the callback argument to the google-maps script URL and add the defer and async attributes to the google-maps script tag. Also make custom-scripts a dependency for google-maps: … Read more

Remove extra Google Maps script

EDIT : use wp_enqueue_script as you want (enqueue in header or footer after jQuery as you want) to enqueue file called something like : gmap.js included in your plugin wp_enqueue_script(‘custom-gmap’, plugin_dir_url( __FILE__ ).’inc/js/gmap.js’, array(‘jquery’), false, true);//just change your path and name of file write this in your Js file 🙂 $(document).ready(function() { if (typeof google … Read more