Do you have questions like How Two wordpress sites using diiferent themes on the same database or How to run Two WordPress blogs with different themes and with single database and same content
Suppose you have a website “learningcage.com“ and you want to launch a subdomain with same content for its mobile user i.e “m.learningcage.com” but with different themes and plugins as per your requirement.
This is one of the most trending question and it is very hard to find its correct solution and implementation over internet . In this article , i will tell you all the steps for its correct implementation.
Follow the Steps Provided Below :
- First Create a Subdomain/Domain where you want to use same content as main website.
- Now , copy All wordpress files to subdomain Root.
- Edit wp-config.php , and modify both Website Files as :
In Website 1 :define('WP_HOME','http://A.mysite.com'); define('WP_SITEURL','http://A.mysite.com');
In Website 2 :
define('WP_HOME','http://B.mysite.com'); define('WP_SITEURL','http://B.mysite.com');
- Now , We have to Add one more database table i.e wp_options2 in phpmyadmin so that we can add different themes and plugins independently on both websites. To , import wp_options2 , just export wp_options table , Edit it in any Text Editor Like sublime Text and Replace all wp_options with wp_options2 . Finally import this table in phpmyadmin and you can see that a wp_option2 table will be created with all fields. Make SiteUrl and homepage in wp_options2 as “/“.
- In second Website go to wp-config.php, and before if (!defined(‘ABSPATH’)) add following code :
define( 'M7_OPTIONS_TABLE', 'wp_options2');
- In second Website File Manager , go to wp-includes/wp-db.php on line 999 and add code:
if (isset( $tables['options'] ) && defined('M7_OPTIONS_TABLE')) $tables['options'] = M7_OPTIONS_TABLE;
These codes should be added in public function tables function, before
if (isset( $tables['users']) && defined('CUSTOM_USER_TABLE')))
That’s it , Now you can login and Add plugins, themes independently . Both Sites will share same post , pages .
Thanks for Reading this Articles. Do you Like this Article ? Share your thoughts in the comments below!
来源:https://learningcage.com/how-to-run-two-different-wordpress-website-with-same-database-but-different-themes/