Tag Info

Hot answers tagged

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


4

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

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


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

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

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

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

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.


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

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

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

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

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


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

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

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

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

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


1

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

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


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

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

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

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


1

After some more Googling... New single.php looks like this: <?php get_header(); global $wp_query; if ( ! isset( $wp_query->query_vars['map'] ) ) { if (have_posts()) : while (have_posts()) : the_post(); the_title(); the_content(); endwhile; endif; ?> <p><a ...


1

if u think that is the problem simply do: $csf_map_output .= '<script> jQuery(document).ready(function(){ var csf_map_params = ' . json_encode( $atts ) . '; csf_map_maker_js( csf_map_params ); }); </script>'; I don't see any scope issues with the above code.


1

Take a look at this I did for a client: http://lpoc.co.uk/properties-for-sale/ A user can click the map and choose where to search. When a user clicks it updates a couple of hidden fields. Feel free to look at the source code to see how its done. If you want a more in depth description of the google maps api and javascript then this question would be ...


1

Have you looked into wordpress extended plugins? If not, I suggest looking into RomeLuv Google Maps for WordPress - it looks like what you may be looking for.


1

Unfortunately there is no easy fix for this, I tried this myself a while ago, and ended up not using any tabs for map rendering since it was the only reliable option. I had some success with messing about with CSS but all browsers (and mobile) reacted differently. The reason is Google maps computes it's values on page load, there are some hacky solutions ...



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