• Resolved Michael v.d. Berg

    (@michaelvdberg)


    I have a question. WordPress saved all posts, pages and images in a database. I would like to install a multi-functional theme (like Jupiter/BeTheme/Bridge) as the theme of the WordPress website, but it saved some settings in the same database.

    Is it possible to save the theme settings of the multi-functional theme in a different database? And if it’s possible, how can I setup this connection?

    For example:
    – Posts/pages/images in Database 1
    – Multi-functional theme in Database 2

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi!

    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 table

    class InstalaDesinstala {
    
      
        function create_tables() {
            global $wpdb;
            require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
    
            $sql_partners = " 
                                CREATE TABLE <code>&quot; . $wpdb->prefix . &quot;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.

    Thread Starter Michael v.d. Berg

    (@michaelvdberg)

    Great, thank you for your quick reply and code. I will try it and configure it to my server. Thanks for your help! Have a good one ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Theme settings in database’ is closed to new replies.