With custom professional theme you need to add the custom table in wordpress database, Using this code you can, add new tables using wordpress theme
add new tables using wordpress theme
If you want to add one more table to wordpress database you need to just use the following code.
Open the functions.php file and copy paste the code.
[viral-lock message=”Solution code is Hidden! It’s Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.”]
$wordpressapi_db_version = "1.0"; global $wpdb; global $wordpressapi_db_version; $table_name = $wpdb->prefix . "liveshoutbox"; if($wpdb->get_var("show tables like '$table_name'") != $table_name) { $sql = "CREATE TABLE " . $table_name . " ( id mediumint(9) NOT NULL AUTO_INCREMENT, time bigint(11) DEFAULT '0' NOT NULL, name tinytext NOT NULL, text text NOT NULL, url VARCHAR(55) NOT NULL, UNIQUE KEY id (id) );"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); $welcome_name = "Mr. WordPress"; $welcome_text = "Congratulations, you just completed the installation!"; $insert = "INSERT INTO " . $table_name . " (time, name, text) " . "VALUES ('" . time() . "','" . $wpdb->escape($welcome_name) . "','" . $wpdb->escape($welcome_text) . "')"; $results = $wpdb->query( $insert ); add_option("wordpressapi_db_version", $wordpressapi_db_version); }
[/viral-lock]
register_activation_hook(__FILE__,'YOUR_FUNCTION_NAME');
I suggest using CREATE TABLE IF NOT EXISTS instead of querying twice.