Reputation: 67
In my new job, our main website is using wordpress at www.company.com.
I'm building a company intranet that I'd like to use a different wordpress theme for, and don't want to mess up the main website. I was thinking that I should create a subdomain (i.e. intranet.company.com) and install wordpress there so that I can use a different theme, but now I'm reading about something called Multisite and I'm just super confused as to what I'm supposed to do.
Is it better to go the multisite route, or just create a subdomain and install wordpress there so that I can use a different theme?
Thank you.
Upvotes: 5
Views: 11710
Reputation: 681
You can't literally use another theme on the same installation, but "theme" is just an abstraction after all, it can be made of an unlimited number of completely different templates, so... What you CAN do is trick Wordpress into thinking it's the same theme. A bit quirky, but otherwise fairly easy.
Big caveat: If you're looking to install an off-the-shelf theme, it's probably not worth the trouble, most likely some components down the road will break. Another caveat: Urls will become duplicate, so you may want to either properly set up wp-config to account for this, or rewrite them on the fly or maybe just set up canonicals
But if it's something purpose made, or a very simple cleanly-crafted theme or just prototyping, it works nicely.
So you have your fresh subdomain. All you have to do here is create an index.php, with a single line pointing to your main installation:
require ('/your/path/to/wp/wp-blog-header.php' );
Great progress already! At this point, your subdomain mirrors your website.
Now you want to display something else there. Add this to your functions.php:
add_filter( 'template_include', 'subdomain_theme', 99 );
function subdomain_theme( $template ) {
$uri = $_SERVER['SERVER_NAME'];
if (strpos($uri,'yoursubdomain.') !== FALSE) {
$new_template = '/your/path/to/wp/wp-content/themes/your-subdomain-theme/index.php';
if ( '' != $new_template ) {
return $new_template ;
}
}
return $template;
}
And now you have your 'basic theme' up and running!
If you want to use more templates than just index.php, you'll have to rebuild some of the wp template logic. So, create a new file in your theme directory and point to it. The relevant line from above becomes:
$new_template = '/your/path/to/wp/wp-content/themes/your-subdomain-theme/whatever.php';
And inside whatever.php point to each actual template in part:
if(is_single()) {include('/home/standard.wp/wp-content/themes/feeds/single.php');}
elseif (is_home()) { // ... easy from here
And there's your subdomain separate theme running on the same no-multisite wp instance.
Upvotes: 1
Reputation: 2744
multisite network is a collection of sites that all share the same WordPress installation. They can also share plugins and themes.
The individual sites in the network are virtual sites in the sense that they do not have their own directories on your server, although they do have separate directories for media uploads within the shared installation, and they do have separate tables in the database.
for details http://codex.wordpress.org/Create_A_Network
SO in your case if you can create subdomain. then you can also install new wordpress on your subdomain.
just diff is. you need to upload plugin .theme.. etc all from your new admin.
and yes you can use another theme etc for your subdomain.
Step -1 create addon subdomain
step -2 install new wp on subdomin. and set up database
step -3. uplaod new theme and then use diff theme in subdomain
Upvotes: 5