Run two wordpress sites from the same database - same content

Hi, ive scoured the web looking for this answer but there seesm to be nothing up to date. I have a web portfolio running on wordpress which i want two themes for. I thought it would be easy to have two installs and change the theme on one. Duplicating the tables (wp_options) was easy but i have no idea how to tell the second installation to use the new table ( which points to the new folder) - I started making a tutorial to help others (http://ahimsa-creative.com/ahimsa_collective/AC2011/helpers/wordpress/run-two-sites-from-the-same-database/ ) from the other tutorials i saw on the web, but the last step cannot be done as the code in wordpress has changed...

Anyone know an easy way to have two wordpress installations running from the same database? or is there an easier way to have switchable themes
ahimsaloveAsked:
Who is Participating?
 
Jason C. LevineConnect With a Mentor No oneCommented:
How does one make federated tables

One reads the second link I provided which explains the command syntax in great detail.  You should be able to run in on the same server as long as you have different databases.  If all tables are in the same database, you're going to be forced to MySQL Table Replication and that's not a good place to be.

Is there an easier way to have two themes running on wordpress?

You can use a plugin but that's really meant to give a site a user-choosable skin experience and not really germane to what you are trying to do by having one database power two sites.  Check this plugin out:

http://premium.wpmudev.org/project/advanced-theme-switcher/

Another reason people don't spend a lot of time worrying about this is that the new Panda/Penguin rules at Google will absolutely murder both sites for posting identical content.
0
 
Jason C. LevineNo oneCommented:
You can do this on the sly using MySQL federated tables:

http://dev.mysql.com/doc/refman/5.0/en/federated-storage-engine.html

The flow would go somewhat like this:

1) Create WP site #1 in database 1
2) Create WP site #2 in database 2 using the same table prefix as #1 (if using prefixes)
3) Drop all the tables in database 2 EXCEPT wp_options
4) Run the appropriate CREATE TABLE commands using the federated storage engine per the instructions at http://dev.mysql.com/doc/refman/5.0/en/federated-use.html on all of the WP tables in database 1 except wp_options.

At the end of those steps, you would have all of the content and user and meta tables replicated on both databases but independent wp_options tables.  That should allow you to define different themes.

Your linked article involves hacking the WP core files (specifically wp-settings.php) and anyone following it would lose all of the changes on the next WordPress update.
0
 
ahimsaloveAuthor Commented:
Thanks for the advice. How does one make federated tables... I read about them and it says they need to be on different servers? Is there an easier way to have two themes running on wordpress? seems like a lot of work for a seemingly simple task. Im still extremely new to mySql and all the fact that it all happens with commands is kind of scary.

I read one article that said to try these two plugins - theme switcher and theme preview. Both are outdated though and i havent tried them yet. Would that be a better way to switch themes on the fly.... ?

thanks a lot
0
 
ahimsaloveAuthor Commented:
Thanks a lot...  yes i had heard about the google thing but hadnt really factored it in that much.. Thanks for reminding me. It my personal portfolio site, so i dnt need a good google ranking, but better it play it safer... ill try the plugin and hope it goes well... thanks a lot
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.