R
R
RockyMotion2020-04-19 16:54:52
OpenStreetMap
RockyMotion, 2020-04-19 16:54:52

How to display all labels in openstreetmap in Wordpress?

Such a question, I use the ACF plugin on wordpress, created a field through the ACF OpenStreetMap Field extension and add the coordinates of each card there.

I am looking for an opportunity to display all the coordinates from all the cards on a separate page, i.e. make a map of all points from the site.
Maybe someone knows the necessary solution or some articles about this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Sarvarov, 2020-04-19
@megakor

A separate page is created with an empty map.
When loading this page, there is an Ajax request to /wp-admin/admin-ajax.php

$.ajax({
        type: 'POST',
        url: '/wp-admin/admin-ajax.php',
        success: function(data) {
            markers = $.parseJSON(data);
            // добавляем маркеры на карту
        }
    });

On the server, we do select coordinates (in wordpress, it seems to be done through get_posts or wpdb).
We return this data using JSON to our client.
Using js to add labels to the map

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question