WordPress.org

Ready to get started?Download WordPress

Forums

Two Sites, Two Themes, One Database (Same Content) (19 posts)

  1. sw33t
    Member
    Posted 8 years ago #

    Hello all! I have a client who wants to have two sites and two different themes but with the same content. It may sound weird, but he has a good reason for it which I won't get in to for time's sake... I love WP and I would love to offer it as a solution but I can't find anyone else who's tried this - or maybe someone here can link me to it (pretty please! i found a bunch of "multisite" stuff with a bunch of broken links) - or just tell me if it can be done, what needs to happen?

    Thanks a bunch!!

  2. hami
    Member
    Posted 8 years ago #

    This should be easy enough to do.

    Install the first copy of WordPress into a folder and get it set up. Duplicate the WordPress folder and then hey-presto, two copies of WordPress using the same database.

    You can then give each one it's own theme.

    Hope that helps,

    / Hami

  3. sw33t
    Member
    Posted 8 years ago #

    Thanks hami, I gave that a try, but using separate domains ... all of the links point back to the original site ... I can't say I know why! (I do have url rewriting on, if that matters)

    Any ideas?

  4. hami
    Member
    Posted 8 years ago #

    Are the domains hosted on the same server?
    If so you could point one domain to one WordPress install and the other to the second.

    You shouldn't have a problem having the database on one domain and a WordPress install on another.

    If you use the method I described above, I forgot to say you will need to go into the settings of WordPress and tell it where it is stored and also the URL it's using. Otherwise you'll have rewrite issues.

    / Hami

  5. sw33t
    Member
    Posted 8 years ago #

    Yes, they are on the same server. I tried logging in, but since all of the links are pointing to the original site, I can't figure out a way in to the admin section. Is there a way around this, or a file where the "pointing" information is stored?

  6. Chris_K
    Member
    Posted 8 years ago #

    as you probably have noticed, the "pointing" information is configured in the database. You can see it, as Admin, by going to Options -> General and looking at the two URI values.

    Instead of all these hoop jumpings, why not use a Syndication plugin to feed one blog from the other's RSS (i.e. 2 seperate installs)?

    http://codex.wordpress.org/Plugins/Syndication

  7. sw33t
    Member
    Posted 8 years ago #

    Now that's a good idea ... any tips or good plugin choices to recommend?

  8. moshu
    Member
    Posted 8 years ago #

    hami's "method" is totally wrong: the URIs and the setting of the active theme are all stored in the database - so you cannot have double values!

  9. Chris_K
    Member
    Posted 8 years ago #

    sw33t - I've not played with these much at all, but I've seen FeedWordPress mentioned a few times. After a quick glance, it appears that it would do what you're after.

  10. pizdin_dim
    Member
    Posted 8 years ago #

    Like moshu said, the database holds the essence of everything, including the configuration settings, like directory location. The database doesn't support multiple settings, so what you want can't be done.

    "two different themes but with the same content. It may sound weird, but he has a good reason for it which I won't get in to for time's sake."

    Hmmm? Why would this be so? It sounds a bit "dodgy" as this effectively duplicates content from the search engines point of view, so you need to be careful here.

  11. sw33t
    Member
    Posted 8 years ago #

    Well, he wants to offer some industry information to potential clients. This site would be his "company" site where people can see how smart he is. It will help make the sale.

    He also wants another URL that he can show people/advertise/etc that doesn't have his company logo and possibly looks entirely different. People can read the same information but not feel pressured to call or buy anything. When they do see how smart he is, and then click the contact page, it will be the same stuff.

    Now that I've typed this out for myself, I realize that it sounds silly, and yet it doesn't. He does want to have two domains ... although maybe it would make sense to do one or the other. I'm afraid I may not be able to change his mind, and I'm not sure using a subdomain will be an answer either. Do you guys have any ideas? I really appreciate it!

  12. hami
    Member
    Posted 8 years ago #

    essh - moshu your totally right, I forgot the theme change might cause problems.

    Would it not work if the themes were called the same name, but the URI were set to be respective of the different domains?

    I used that "method" to clone a WordPress install so that I had a 'development' version to try out new tweeks on.

    I know it's not a pretty solution, but it should work. Anyway thought it might help.

    / Hami

  13. wyrd33
    Member
    Posted 8 years ago #

    Easiest way to do this would be to build the site using a generic XHTML base, then dynamically use a CSS file based on the domain the user is viewing. You should be able to do this fairly easily with a few PHP commands. I'd try parse_url() : http://us2.php.net/manual/en/function.parse-url.php

  14. sw33t
    Member
    Posted 8 years ago #

    thanks again, ya'll rock! :D
    - sarah

  15. pizdin_dim
    Member
    Posted 8 years ago #

    "I'm afraid I may not be able to change his mind, and I'm not sure using a subdomain will be an answer either."

    Even a subdomain is likely to get you into trouble with the search engines, if the content is duplicated. As you're probably aware, this is considered as "polluting" the search engine databases and they don't approve of it. Your client should be aware of this, if he's considering having the sites indexed at all.

  16. sw33t
    Member
    Posted 8 years ago #

    Yeah, you're right. I have another conference call with him today, and had some time to think about this overnight. I appreciate everyone's input. I haven't been able to find good people to chat web and code with, until now!

  17. pkirk
    Member
    Posted 8 years ago #

    Same need here.
    I think I'm goin to hardcode themes' and URLs' settings.
    So WP will also not do a query to the db each time.

  18. mylagoon
    Member
    Posted 8 years ago #

    I've done this before, having 6 websites shoot out content from the same database.

    It's easy enough to do. Upload WP into both directories. Make sure they have the identical wp-config.php file.

    In the second sites directory do the following:
    In the wp-settings.php file change the options database value to something like this:

    // Table names
    $wpdb->posts = $table_prefix . 'posts';
    $wpdb->users = $table_prefix . 'users';
    $wpdb->categories = $table_prefix . 'categories';
    $wpdb->post2cat = $table_prefix . 'post2cat';
    $wpdb->comments = $table_prefix . 'comments';
    $wpdb->links = $table_prefix . 'links';
    $wpdb->linkcategories = $table_prefix . 'linkcategories';
    $wpdb->options = 'YOURNEWPREFIX_options';
    $wpdb->postmeta = $table_prefix . 'postmeta';
    $wpdb->usermeta = $table_prefix . 'usermeta';

    $wpdb->prefix = $table_prefix;

    See how I've removed $table_prefix . in the options line?
    Instead of YOURNEWPREFIX put something like 'site2' or whatever you want.

    Then, in PHPmyAdmin duplicate the wp_options table, and rename one of the them to be YOURNEWPREFIX_options, so if you chose 'site2', it would be 'site2_options'.

    Bingo. Edit the information in the 'site2_options' table to refelct the correct information for your second site and you will be on your way.

  19. djgeeked
    Member
    Posted 7 years ago #

    Mylagoon....thanks for the post. I was looking for that exact solution.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.