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