Wordpress, using different theme: Subdomain or Multisite? - wordpress

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.

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

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.

Related

insert php plugins not working Wordpress

In my projects, there are many links of forms, certificates. If suppose client want to migrate the project from one domain to another, automatically links should be updated. For that purpose, I have used Insert php plugin in wordpress. Also I have activated that plugin as per the given instructions. Unfortunately shortcode is also displaying in frontend. How should i get homeurl in frontend using this plugin.
Please don't use this plugin. I think enabling PHP in WordPress content is a high security risk. If the only thing you need is the home url, we you don't user relative paths? Then you are using always the right URL.
If that is not an option, consider creating a shortcode for replacing it with the home url.
//[home_url]
function home_url_shortcode( $atts ){
return home_url();
}
add_shortcode( 'home_url', 'home_url_shortcode' );
Place this in your themes functions.php and use it with [home_url]
Besides the solution of the above. If you migrate a WordPress project you should run a search/replace on the database for the old and the new domain. WordPress uses the full domain on multiple occasions. So this is not a solid solution.
https://wordpress.org/plugins/wp-migrate-db/
https://deliciousbrains.com/wp-migrate-db-pro/

Wordpress Multisite and Subdirectory

This sounds so noob. But I'm really new to wordpress. :)
If I create a multisite then create a new site under it, does wordpress automatically create the files? or will I be the one to install wordpress into its subdirectory?
You need to install one copy of WordPress normally first, but it only needs that single copy of all the core files – /wp-admin/, /wp-includes/, /wp-content/ etc. - to run all of the sites.
To add a new site, you just use the Network Admin menu and it puts any site-specific files for each additional site (other than your first one, that is) in numbered subdirectories.
E.g. media Library files, end up in subdirectories of /wp-content/uploads/sites/.
If you haven't already setup multisite, you need this line in your wp-config.php:
define( 'WP_ALLOW_MULTISITE', true );
Further reading:
https://codex.wordpress.org/Create_A_Network
https://codex.wordpress.org/Multisite_Network_Administration
Opinion: I wouldn't recommend multisite for a complete beginner – things can get really confusing even for experienced users. The WordPress install process is very straightforward so if you have good hosting you shouldn't have trouble running separate, individual sites on the same server.

In wordpress multisite how can I allow users to install their own plugins?

My goal is to make it so users can upload their own plugins and themes, and I would like to add most of the things that are in the normal non-multisite WordPress admin as well. What files control the multisite user dashboard in WordPress?
The short answer is: you can't.
Only the main site has a /wp-content/ folder, all the sub sites are virtualized and share the /themes/ and /plugins/ folder with the main site.
From the Codex, Create_A_Network my emphasis :
A 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.
[...]
Installing themes and plugins is different: for example, each individual site of a network can activate both, but install neither.
To achieve what you want, you'd have to grant Super Admin capabilities to your users. Meaning that they'd have full access to the whole network.
The files that control a Multisite are contained in the folder /wp-admin/network/, but "some are just wrappers for regular admin files one level up".
For example, inside the file /wp-admin/plugins.php we have the following which means roughly "if it's Multisite, you can't install plugins":
if ( ( ! is_multisite() || is_network_admin() ) && current_user_can('install_plugins') ) {
?>
<?php echo esc_html_x('Add New', 'plugin'); ?>
<?php }
With that said, there are some plugins to help with the management of Multisite plugins, but not for the purposes you want: http://wordpress.org/extend/plugins/search.php?q=multisite+plugins
you can try
https://wordpress.org/plugins/jamjar-plugin-installer/
It supports multi side and allows users to install plugin in their individual sites.
You Can't. But You Can Install Selected Plugins To Your Site. Rename the plugin meenu and the section to plugin market thing..... and then you can make all the plugins come in a grid form with a screenshot of every single plugin so that if your user wants any of the plugins he can cick-see-the details-then install it.... that would be very sexy. and its faar more easy too..... you just have to tweak in all of your theme's functions.php so that even if a user changes to another theme he wont lose the market.....

Implement Multisite in wordpress in sub directories

I am trying to implement multisite so that I can add several other blogs.
I added define('WP_ALLOW_MULTISITE', true); line of code in wp-config.php file under define('WPLANG', '');
When I look at the configure network panel I get this message:
"Because your install is not new, the sites in your WordPress network must use sub-domains. The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links."
I want all my blogs to be in sub directories.
Like : http://abcd.com/site1, http://abcd.com/site2, http://abcd.com/site3
What should I do so that I can proceed with installing the multisite option using sub directories?
Hi Try adding the following code in your themes functions.php . It w
add_filter( 'allow_subdirectory_install',
create_function( '', 'return true;' )
);
That’s it. Now reload the Network page and you will see option to choose between sub-domain and sub-directory. Once done remove the code from functions.php.
Source tip credit
To answer your question:
http://codex.wordpress.org/Multisite_Network_Administration#Switching_network_types
But please note that if your site is older than a month, you might have serious conflict issues between pages and sites. Read the directions I provided, and read the cautions. As always, BACK UP YOUR DATABASE AND FILES... including the wp-config.php and .htaccess files :)

Wordpress - Clone plugins (with settings) to new WP install

Is there a way to clone a Wordpress website but keep all the plugin settings etc for a completely new website?
I've turned Wordpress into a cms with the help of some plugins and some of my own tweaks. I want to roll this out as the cms I use for every website I create so therefore don't want to have to install all the plugins each time and adjust their settings.
I don't want to copy the content of the site just the plugins.
It's not as simple as ftp'ing all the files down then up to some new hosting space.
How can I go about cloning the website?
Would wordpress multisite work for this? I know it does sub domains etc but can I use multisite over several different domains?
A backup of the database, and a copy of the files in the wordpress directories. On the new site, you would need to have changed the URL in the config database, which if you backup the database you could change in the text file you backed up to, before uploading to the new site.
Also http://codex.wordpress.org/Changing_The_Site_URL suggests you could set a setting and any chances will be auto reflected when you load it somewhere else.
Have you checked if the copy wasn't corrupted?
Please check if the /home/biologic/public_html/wp-includes/load.php file is there.
Or maybe the ABSPATH above is wrong... if it is, then check if you have this on your wp-config.php file:
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
if it is there, replace dirname(__FILE__) . '/' with the actual absolute path, hardcoding it.
I've figured out the process:
Ftp down the files from your existing site.
Change the wp_config to the new details of the database.
Ftp up the files to the new site.
Download the database of the old site.
Import into the database of the new site. Change the wp_options siteurl to the new site address.
Login to the admin and change the site address to the new domain.
Update the permalinks.
The site is cloned successfully.

Resources