两个Wordpress使用相同的文章等数据库但是使用不同的主题

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 :

  1. First Create a Subdomain/Domain where you want to use same content as main website.
  2. Now , copy All wordpress files to subdomain Root.
  3. 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');
    
  4. 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 “/“.
  5. In second Website go to wp-config.php, and before if (!defined(‘ABSPATH’)) add following code :
     define( 'M7_OPTIONS_TABLE', 'wp_options2');
  6. 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/

 

类别: Wordpress

Leave a Reply

You must be Logged in to post comment.

© 2019 脑壳晕晕. All rights reserved.