Multisite switch to blog

If you use switch_to_blog, that use always also restore_current_blog. The restore_current_blog function undos the last call to switch_to_blog, but only by one step, the calls are not nestable, so always call restore_current_blog before calling switch_to_blog again.

Sort posts according to date

Here’s how I’d attack your problem (in fact I think I’ve written code like this in the past, but I can’t find it at the moment): $blogs = array( 4, 1 ); $all_posts = array(); foreach( $blogs as $blog ) { switch_to_blog( $blog ); $args = array( ‘posts_per_page’ => 10, ‘orderby’ => ‘date’, ‘order’ => … Read more

How can you customize on a multisite?

Looking into the Theme Customizer API, it appears that theme modifications are stored as theme_mods which can be access using get_theme_mod( $mod_name ) or (if you want to grab them all) get_theme_mods(). Peeking into the source of get_theme_mods(), I see that the mods are stored in the site’s options table as theme_mod_$mod_name. So the theme … Read more

How to install seperate theme on certain page

There exist two cases in your question. 1. You want different theme for different pages of single WordPress site. You can achieve this using a plugin – Multiple Themes You want different sites having different admin dashboard and different theme for each site. Then you must use MultiSite.

Multisite 404 page

The easiest way is to check for get_current_blog_id(); and adjust your 404 template based on the current blog id. An other option is creating a child theme for every site and adding different page-404 templates.

Which Multi-language option for WordPress is best from an SEO and Woocommerce perspective?

If you need true localization, like a different checkout process, different themes or product descriptions, then you should use a multisite. You can activate plugins and themes per site here. The problem here is that almost all shopping plugins are not multisite compatible. You have to activate them per site, not as network plugin, or … Read more

The Events Calendar: Events page as Home page [closed]

You should be able to use the code from this answer: https://wordpress.stackexchange.com/a/96068/10 $homepage = get_page_by_title( ‘Events’ ); if ( $homepage ) { update_option( ‘page_on_front’, $homepage->ID ); update_option( ‘show_on_front’, ‘page’ ); } Haven’t tested it with multisite, but my guess is that it should work as advertised.

How to have one installation at blog.example.com and multiple blogs in sub folders such as blog.example.com/userA?

What you are looking for is a WordPress network, aka WP Multi-Site. This is perfectly suited for what you have described. You will want to pay careful attention to the type of multi-site you setup: http://codex.wordpress.org/Before_You_Create_A_Network#Types_of_multisite_network Generally, the choice is between subdomain or subfolder for the type but you actually want subfolder, on your subdomain. … Read more