Answer the question
In order to leave comments, you need to log in
Working with databases in wordpress
I am mastering wordpress, the question is this: on the page you need to display a Yandex.map, the coordinates of objects for the map will be taken from the database, something like this: http://workingmama.ru/places , where to store the coordinates? In a separate database or in a table inside the database of wordpress itself? In general, where is it customary to store data? Links are welcome.
Answer the question
In order to leave comments, you need to log in
It is logical to assume that inside the database that WP uses. Just create a separate table there with object coordinates.
You can add meta fields (custom fields) to each page in wordpress. The values of which are stored in the {prefix}_postmeta table.
Accordingly, in order to add fields for entering coordinates on the post editing page, you can use this plugin .
How to get data already on the record display page is written here .
There are no rules here. Everything depends on the task. For example, it is better to store coordinates, which can be very large, in a separate table. Storing coordinates as posts seems redundant to me and will only lead to unnecessary load.
If you need a web interface for data, then you can use the Pods Framework .
I would advise to implement this through your plugin. In which to implement the installation of the necessary tables in the database and work with them.
It is not necessary to fence separate tables. Custom Post Types, Custom Taxonomies, Custom Fields were designed for just such tasks. And all this joy works through all native methods and becomes part of the overall mechanism. If you use CMS / CMF - use everything that is in it, and do not invent crutches. As one of the ideologues in WordPress Core says - before writing your function, carefully study the documentation - in 9 cases out of 10 you will find a ready-made solution.
@startsevdenis pointed in the right direction where to dig. ACF plugin or mentioned Pods to help. Personally, I would advise ACF, it is more convenient to work with, the interface is nicer and the documentation is orders of magnitude more useful. The Pods documentation will break your head.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question