Z
Z
zholdas2012-10-10 12:01:03
Database
zholdas, 2012-10-10 12:01:03

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

7 answer(s)
S
Sergey, 2012-10-10
@zholdas

It is logical to assume that inside the database that WP uses. Just create a separate table there with object coordinates.

S
startsevdenis, 2012-10-10
@startsevdenis

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 .

I
Igor, 2012-10-10
@igoravr

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 .

D
Dmitry Artemenko, 2012-10-10
@SpectraL

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.

P
Puma Thailand, 2012-10-10
@opium

Store in a separate, garbage in wp native tables is not needed.

J
Jonh Doe, 2012-10-10
@CodeByZen

I would store in the same base, with a different prefix.

I
Igor Vorotnev, 2014-02-21
@HeadOnFire

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 question

Ask a Question

731 491 924 answers to any question