martes, 17 de noviembre de 2009

List all blogs in a Wordpress MU installation

The African Travel Experts site has two dropdown lists of all the blogs on their WPMU installation sorted into two different categories. Here's how.

The way the site is set up is to have the African Travel Experts site as the main 'umbrella site' with sub-sites for each African country, which act as parent sites to sub-sites relating to the country. For example:

Master site: African Travel Experts
Country sub-site: South Africa
Child-site: Cape Town

Seeing as the standard WPMU installation doesn't provide for classifying blogs/sites in this way, a plugin and a bit of lateral thinking was required. I opted for the Blog Types plugin, which allows you to define your own categories for a blog. Once installed, I defined my categories in the config as follows:


// Blog types
// name and nicename are required

$blog_types = 'South Africa';
$blog_types = 'south_africa';
$blog_types = '';
$blog_types = 'no';

$blog_types = 'Botswana';
$blog_types = 'botswana';
$blog_types = '';
$blog_types = 'no';

//.... etc until all countries are defined

$blog_subtypes = 'Cape Town';
$blog_subtypes = 'cape_town';
$blog_subtypes = 'south_africa';
$blog_subtypes = '';

$blog_subtypes = 'Eastern Cape';
$blog_subtypes = 'eastern_cape';
$blog_subtypes = 'south_africa';
$blog_subtypes = '';

//.... etc until all areas are defined

// Allow users to select one or multiple blog types
// Note: If you allow users to select multiple blog types, they cannot select a subtype
$blog_types_selection = 'single'; //Options: 'single' or 'multiple'

// Allow users to select one or multiple blog subtypes
$blog_subtypes_selection = 'single'; //Options: 'single' or 'multiple'

// Branding singular
$blog_types_branding_singular = __('Country');
$blog_subtypes_branding_singular = __('Area');

// Branding plural
$blog_types_branding_plural = __('Countries');
$blog_subtypes_branding_plural = __('Areas');

// Display admin panel blog types page
$blog_types_display_admin_page = 'yes'; //Options: 'yes' or 'no'

// Display signup form blog types selection
$blog_types_display_signup_form = 'yes'; //Options: 'yes' or 'no'

// Enable subtypes
$blog_types_enable_subtypes = 'yes'; //Options: 'yes' or 'no'

No hay comentarios:

Publicar un comentario