be run from a single WP installation (Codex Glossary) • Prior to version 3.0, WordPress MultiUser was required for this functionality • With WordPress version 3.0, Multisite functionality was rolled into WP's core
with many departments within them • Each faculty and department has a website • Each website has its own coterie of editors • With WP Multisite, this is easy to set up and maintain
Codex "Create A Network" page for a full explanation • You need to edit your wp-config.php file... • ...set up your Network in /wp-admin/... • ...and then edit your wp-config.php and .htaccess files again. • Don't panic!
can have its own unique users, but all users are added to a site-wide "pool" of users • A user who is an Administrator on Site A can be a Contributor on Site B, a Subscriber on sites C and D, and have no privileges at all on Site E • Also, Multisite adds a new administrative level: Super Admin, who can make network-wide changes
and is maintained by a handful of people • The news articles are categorized by site -- eg, news for the English homepage is in the English category, news for Physics in the Physics category, etc. • Custom code fetches & displays the news for each site in the BU network
$site_name = get_bloginfo( 'name' ); if( 'News' == $site_name ) return; // no point doing anything *in* the News site $cat_id = bu_get_category_from_site( $site_name ); $url = get_bloginfo( 'wpurl' ); // Some site details $news_site = get_blog_details( 'News' ); $original_site = get_current_blog_id(); // so we can come back later // switch to the news site switch_to_blog( $news_details->blog_id ); // get the posts with category matching the site name $args = array( 'category' => $cat_id, 'numberposts' => 4 ); $articles = get_posts( $args );
The Event Calendar, which will allow site editors to maintain their own events • Events may be suggested for promotion by site editors, so that they might appear on the BU Home Page Event listing • Promoted events must be authorized by a site administrator
the event promotion system. Several checks have been trimmed for brevity: • Checking to ensure we're not in the root site (if we are, bail out with a return; ) • The following must all be true: – tribe_is_event() – event is in the appropriate category in the sub-site – there isn't already a promoted event for the given $id
'_pprredirect_type' => 301, '_pprredirect_rewritelink' => 1, '_pprredirect_url' => $event_url, ); $meta_unique = true; foreach($meta as $key => $value){ add_post_meta($new_event_id, $key, $value, $meta_unique); } switch_to_blog( $from_site_id ); // back from whence you came // once all that's done, add the _bu_promoted_event meta to the original $event // using the new event's $post->ID so it can be removed later, if necessary add_post_meta($id, '_bu_promoted_event', $new_event_id, true); // All done }
nested sub-sites (ie, /arts cannot contain /arts/english) • /arts and /english are two separate sites • With a bit of plugin magic, though, we can set /arts as the parent site of /english, so that breadcrumbs look like this:
also used by the in-house Contact Info plugin • If the current site has no contact information set, the plugin will look to the site's Site Parent, using switch_to_blog() • If there's no contact info there, the plugin ascends level after level, until it gets to the root site • If the root site's contact info is empty, the plugin displays a default string