Answer the question
In order to leave comments, you need to log in
How to add markers to map in wordpress via admin panel?
Hello, I am currently making a map for a personal project (not an order), the labels are output from json, according to the idea, the links in the balloon should lead to a page with this place, I would like to know how this is implemented in WordPress, is there a way to configure this in the admin panel so that you do not have to add coordinates and links to json every time through the code? not very convenient, and if there are a lot of places, then it’s completely inconvenient and takes a lot of time. I looked at various plugins, but their functionality is meager, and it doesn’t look like a design, it’s better to do it yourself, but I don’t understand how to integrate it into wordpress
Answer the question
In order to leave comments, you need to log in
You need to create a meta field for geo-coordinates and fill in for the desired posts. Then you get the necessary posts $variable = get_posts($args);
and in the loop collect an array according to this example
. Data from the meta field can be obtained using get_post_meta()
in the loop
Without plugins (actually with one plugin):
- creates a custom post type
- use ACF to create additional. fields (it will be better, believe me)
- use posts as one place on the map, fill in everything we need, name, address, pictures, content and it doesn’t matter (to fill in data such as address, etc., create additional fields in ACF)
- we take json to the page where it is used (otherwise it doesn’t seem to work)
- we do in JSON via PHP the output of the fields of each of your places on the map (post)
Profit, you get a super-huge bones ... ready json that will be displayed on the map
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question