Hot answers tagged

10

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


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


5

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


4

Wierd, just re-read your comment and looks like your shortcode is working when you call it that early - if the map-canvas div is showing up. here's the code I tested, also added jquery as a dependency for your custom script & changed some css on you div... function lax_google_map_init() { wp_enqueue_script('google-maps', 'http://maps.googleapis.com/...


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


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


3

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


3

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.


3

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


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


2

These errors come from CSS rules from your WordPress theme that are also applied to elements on the map. For example, on your page, I was able to fix the popup by disabling the #content table and #content tr th rules which add extra margins. In a test setup I even got gray gaps between the tiles because of .entry-content img { max-width: 97.5% } in Twenty ...


2

Dean, your best bet is to do it through JS on the front end. I use the following function to covert the postcode to a Lat and Lng: function codeAddress(address){ geocoder.geocode({ 'address': address }, function(results, status){ if(status == google.maps.GeocoderStatus.OK){ map.setCenter(results[0].geometry.location); ...


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

I've done something similar using gmaps (http://gmap.nurtext.de/). You might want to take a look at that. It's self explanatory and there's quite a bit of documentation IF you google around.


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

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


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


1

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 is saved on the back-end. You can geocode addresses with php like ...


1

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


1

Sorry for reviving this post, but it was on the front page and I noticed that it's very old too late... Here's my take on this problem: // This will filter the shortcode attributes and will insert custom // value for the "cat" parameter function filter_gmaps_shortcode_atts( $atts ) { // We add a custom value in the $cat parameter if ( is_tax( '...


1

I have managed to find the problem. Basically calling the google API from the footer was causing the maps to break and not function properly.


1

@Richard, it's hard to answer this in detail with this little details. Do you need to pinpoint a single house? Will you use an address or will you use latitude and longitude? My suggestion would be to take a look at this excellent Google Maps Plugin for jQuery. jQuery is part of any WordPress installation, so you wouldn't need to install anything else. ...


1

The only way to get multiple markers on a map is to use the Google Maps API. https://developers.google.com/maps/documentation/javascript/tutorial. The way you are referencing through an iframe only allows one marker(one location).


1

For create the links to your child sites use this function elenco_sotto_siti(){ global $wpdb; $blogs = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->blogs WHERE public='1' AND archived='0' AND mature='0' AND spam='0' AND deleted='0' ORDER BY blog_id "),ARRAY_A ); return $blogs; } For question 2 and 3, i use the option ...


1

Mapsmarker looks pretty robust. On their feature list page they state that you can organize your markers in layers, so maybe that work for categories. I have not used it. I have used Mappress which allows you to add custom markers and you can create different maps on different pages if you want to categorize them like that.


1

I've used it like this and it works well ;-) $(".div").html("<iframe width='850' height='450' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='http://yourlocation.com'></iframe>"); $(".div").css("display","block");


1

There are a lot of pieces to this puzzle. You need to be able to convert the postcodes into a numerical data format so you can query the pages/posts with "is greater than [current location minus 5 miles] and less than [current location plus 5 miles". In two dimensions. This means storing the latitude and longitude with the page. You can automate this, so ...


1

By default, PHP is stripped out of the posts content. You can use this plugin to aleivate this: http://wordpress.org/extend/plugins/exec-php/ This will give you a quick, easy fix to be able to do it the way you are trying to. I would suggest reading http://codex.wordpress.org/Custom_Fields for the more proper way to do this though.



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