I wish to create a Wordpress website that pulls data from a database. For example: a database of cities, landmarks, events, etc. I understand that Wordpress uses an underlying database, but how do I create a separate database to store dynamic data that can be pulled useing normal sql queries? thank you.
I understand that Wordpress uses an underlying database, but how do I create a separate database to store dynamic data
You can create a new database in mysql using the CREATE DATABASE
command. For example:
CREATE DATABASE newdbname;
You can also utilize the Wordpress API for storing and retrieving custom data. This is a huge topic, but a good tutorial can be found here:
http://code.tutsplus.com/tutorials/how-to-create-custom-wordpress-writemeta-boxes--wp-20336
Basically, you need to register a callback to the add_meta_boxes
hook, by using the following Wordpress function:
add_action('add_meta_boxes', 'addMyCustomField');
And then write your call back function like so:
function addMyCustomField(){
add_meta_box('id', 'title', 'callback', 'post_type', 'context', 'priority', 'callback_args' );
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.