Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Through the custom fields, I assigned to each post its geographic coordinates (latitude/longitude).

Now, I'd like to show a Google Maps with a marker for each post.

Do you have any suggestions on how to do this effectively?

EDIT: Solved following this G.M.'s answer.

share|improve this question
1  
Yesterday I answered a very similar question, see here –  G. M. Jul 25 '13 at 6:39
    
Thanks! With your solution I succeeded. There was a couple of typos I've corrected in the Javascript code. Please consider answer my original question, so I can accept your answer. –  User Jul 26 '13 at 9:33
    
You're welcome. Don't mind about accept the answer, I don't think is good to duplicate an anwer, even if working. Edit the question, instead, and write that you find solution with my aswer and link it. You can consider to upvote my answer, too, if you want :) –  G. M. Jul 26 '13 at 9:49
    
You've already got my +1. Thanks again. –  User Jul 26 '13 at 18:03

2 Answers 2

Lots of ways to proceed here. Here's one way to do it:

  1. Find a JavaScript/jQuery plugin that works with map markers. I used Mosne Map, it's old but it works.

  2. 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 easiest way to attach lat-lang coordinates to that page. Your case would probably be getting those posts with WP_Query and extracting the coordinates from each.

  3. Tie it all together with a shortcode, so that the map can be shown on any page. Again, you don't need this, you can just include all the necessary JS, execute your WP_Query, and generate the necessary HTML anywhere you want to show the map.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.