How to build a site with a map that shows where people offer and need help?
How to build a site with a map that shows where people offer and need help?
How to build a site with a map that shows where people offer and need help?
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 href=”https://wordpress.stackexchange.com/questions/31442/<?php echo get_permalink(); ?>?map=yes”>Map</a></p> <?php } else { ?> <div id=”map-canvas”></div> <?php } get_footer(); And functions.php like this: add_filter(‘query_vars’, ‘parameter_queryvars’ ); … Read more
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 … Read more
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 … Read more
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 … Read more
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. … Read more
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” => “publish”, //by default they are drafts … Read more
I’m not sure whether you are using a plugin, or you are coding it yourself. Either way, you can use server side or client side to decode or encode your content. PHP offers the utf8_decode(); and utf8_encode(); functions, that can be used to decode or encode your content before sending it to the browser, or … Read more
You can install HTTP/HTTPS Remover plugin to fix the issue. Generally, it works with all the plugins and themes. You can download and install the plugin from https://wordpress.org/plugins/http-https-remover/
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.