11

Can do this without any plugin, you need only the Google Maps API. Please note that if you plan to have 20 markers or more on a single page, you have to geolocate posts using coordinates and not addresses. To save coordinates from an address you can: manually use a service (something like this) call Google maps geocoding from WP admin when you create or ...


9

For anyone looking for this answer in the future, I took woony's code the extra mile and got everything working within Wordpress' post_meta table structure. This assumes you have two separate custom fields, one for Latitude (city_latitude) and one for longitude (city_longitude). Just pass the latitude, longitude, and distance parameters into a WP function ...


7

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 :) $(...


6

This is a simple mathimatical problem. You will indeed need access to both your longitude and latitude, so save it in a metafield. than you will have to query your posts like this as a sql query. Haven't got a chance to test it. and or pour it into wordpress. Don't have access to my test env now. But I guess you could do it yourself :) if not I'll do it ...


5

You should avoid creating more tables. Just do it if you really have a good reason to. Note that wp_postmeta can store practically any kind of data, and simply using the get_post_meta function can do all the job in most cases. But if you must use another table, and taking it generally, then you're looking for the save_post and delete_post hooks. ...


4

I think GeoMashup is the go-to plugin for something like this. http://wordpress.org/extend/plugins/geo-mashup/ I've used it for a similar site with great results. There's a lot to dig into, it's very flexible, but you'll definitely be able to get what you want.


4

Don't stress about it. There are many ways in which plugins and themes can break each other and you just can not avoid it when everything happens in the same execution space/context. You should test against whatever plugins and themes you want to make sure your code works with but there is just no way to make everybody at every point in time happy. Actually ...


4

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-...


3

You are using iframe in tab structure.So, 1) When page loads fully, the iframe in itenary tab has display none. so it is not loading the zoomed map properly. 2) When you switch to itenary tab before loading completes, iframe is display block i.e visible so it loads the url/map properly. So for this what you can do is give id to your iframe say "#...


3

Lots of ways to proceed here. Here's one way to do it: Find a JavaScript/jQuery plugin that works with map markers. I used Mosne Map, it's old but it works. Generate the HTML markup that the above plugin will use. I needed a more user-friendly way to add markers, so I utilized ACF's Repeater Field type for this because I had one page with a map, so it was ...


3

Well, this is kind of easy.. The google-map API needs a format like Your Street 123, 54321 Your City Assuming you have your data like this: <div id="street">Your Street 123</div> <div id="zip">54321</div> <div id="city">Your City</div> Assuming you are using jQuery: (function($){ $.fn.create_gmap_address = ...


2

You could use this plugin, although it may only be compatible to 3.2.1. And this plugin may help you out, although it seems a little complicated to implement a map for all the posts. You could also use a custom field for lat/long on each post, and then create markers using wpdb calls, grabbing the post_meta data, and using the Google Maps API to place the ...


2

Nm, figured it out: <?php echo GeoMashup::map( 'map_content=global&map_cat=1,2,3,4,5' . $cat->term_id ); ?>


2

To connect your meta fields with the "Geo Data Store"-Plugin, you simply take the name of the meta key/field and map it with the filter to the plugin. add_filter( 'sc_geodatastore_meta_keys', 'wpse82502_lat_lng_metakey_mapping' ); function wpse82502_lat_lng_metakey_mapping( $keys ) { $keys[] = "your_meta_key_field_name"; return $keys; } To get the ...


2

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' => ...


1

So I figured out the issue. I wasn't familiar enough with how urls are handled in XMLHttpRequest. I needed to change downloadUrl("http://wp-content/themes/oxygen-child/phpsqlajax_genxml3.php", function(data) { to downloadUrl("http://www.theworldsflgiht.com/wp-content/themes/oxygen-child/phpsqlajax_genxml3.php", function(data) { Thanks for the help ...


1

You can use the WP REST API plugin to add/manipulate/present media of a WordPress install from within your app. The page creation part I am not sure of, perhaps it'll need to be done manually - or you can create pages via the /pages/ endpoint. I'll let someone correct me if I'm wrong, but the API endpoints (which are available at the link as a plugin) ...


1

Is this what you are asking for? Use it after the code you posted to create posts in loop and use thier ids to update meta fields. Replace "post_type" with your custom post type. foreach ($markers as $marker){ $post_id = wp_insert_post(array( "post_title" => "something", "post_type" => "your-type", "post_status" => "...


1

Step one: Familiarize yourself with Google Maps Embed API; and sign up for API key: The iframe embed option, unlike the Javascript API, does not have usage limits but does not have as many options/features. Determine which MODE you require and observe the required url format and parameters. Step two: Collect address from user. For the sake of this ...


1

I had to add #map-canvas { height:100%!; } to my stylesheet.


1

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_$...


1

The default search is handled by WP_Query mostly by a method called parse_search(), which is triggered by the s parameter. You can search the source of WP_Query for is_search and piece together a few other bits and pieces. Or you can just create a query... $s = new WP_Query(array('s' => 'test')); ... dump the SQL... var_dump($s->request); ... and ...


1

I've done something similar for a client. I found it easiest to create my custom post types as part of a plugin and network activate it. Without reinventing the wheel, I used a plugin from WPMU Dev to show those posts on the main site. If creating the custom post type isn't your forte, WPMU Dev has a plugin that will help you with creating them. WPMU Dev ...


1

$prop_mapaddress contains your textfield value: <?php if(isset($prop_mapaddress)) { global $post; global $wpdb; $fromat_address = trim($prop_mapaddress); $fromat_address = str_replace(" ","+",$fromat_address); $address_obj = file_get_contents("http://maps.googleapis.com/maps/api/geocode/json?address=".$...


1

Use wp_localize_script: wp_enqueue_script('YOUR_SCRIPT_HANDLE'); $object = array( 'zoom' => get_option('map_zoom'), 'longitude' => get_option('map_longitude'), 'latitude' => get_option('map_latitude'), ); wp_localize_script('YOUR_SCRIPT_HANDLE', 'JSObject', $object); And then use it in your JS file like JSObject.zoom and the like.


1

I sugges you use wp_localize_script: http://codex.wordpress.org/Function_Reference/wp_localize_script to include arbitrary js data in your page


1

The best plugin I've found so far for this is Mappress...there is a pro version, which you might need. I've got it implemented here in the way you describe.


1

You have quite a bit of markup for that shortcode. Trying to pass all of that as a shortcode is going to be trouble. I pulled it apart to look at it. id="map" z="11" w="100%" h="300" scrollwheel="false" maptype="ROADMAP" address="Southampton, United Kingdom" marker="true" markerimage="http://anachronistic.local:9102/wp-content/plugins/_TomRush/inc/js/...


1

Probably safest to put HTML content in as the "content" of an enclosing shortcode, not one of the "attributes": [my_gmaps ...] HTML here [/my_gmaps] Then access that block as the second parameter to the shortcode function: function my_shortcode($attrs, $content) {}


1

I implemented a similar custom store locator for a client, and what I ended up doing was saving each lat / lon pair as post meta for a single location post type, and then assigning each location post type to a parent store post type. that way, a single store could have multiple unique locations. location posts were hidden in admin and managed via a custom ...


Only top voted, non community-wiki answers of a minimum length are eligible