brendovale
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Fixing WordPress
In reply to: Theme settings in databaseHi!
You can make a class ‘MyDBCon’
class MyDbCon{
//SetUp you php connection
}in you plugin or function …
call class.
or
Make a new table in you wp database!
See this code do add a tableclass InstalaDesinstala { function create_tables() { global $wpdb; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); $sql_partners = " CREATE TABLE <code>" . $wpdb->prefix . "cliente</code> ( <code>id</code> int(10) UNSIGNED NOT NULL, <code>cliente</code> varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, <code>categoria</code> varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, <code>estado</code> varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, <code>endereco</code> varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, <code>telefone</code> varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, <code>email</code> varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, <code>logo</code> text COLLATE utf8mb4_unicode_ci, <code>created_at</code> timestamp NULL DEFAULT NULL, <code>updated_at</code> timestamp NULL DEFAULT NULL, <code>deleted_at</code> timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; "; dbDelta($sql_partners); } }
you can call this -> register_activation_hook <- on you theme install.
see
function INSTALL() { you call } function UNINSTALL() { you call } register_activation_hook(__FILE__, 'INSTALL'); register_deactivation_hook(__FILE__, 'UNINSTALL');
see you man .
sorry for my english.
Viewing 1 replies (of 1 total)