Blog

The Haycroft Media Blog covers all aspects of website design and development from the web browsers being used through to the standards that govern the world wide web. As a website design and development company, it is imperative that we keep abreast of all the latest news and happenings in our field, and here we present the major stories along with tutorials, tips and other web-programming related items.

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[0]['name'] = 'South Africa';
$blog_types[0]['nicename'] = 'south_africa';
$blog_types[0]['description'] = '';
$blog_types[0]['signup_only'] = 'no';

$blog_types[1]['name'] = 'Botswana';
$blog_types[1]['nicename'] = 'botswana';
$blog_types[1]['description'] = '';
$blog_types[1]['signup_only'] = 'no';

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

$blog_subtypes[0]['name'] = 'Cape Town';
$blog_subtypes[0]['nicename'] = 'cape_town';
$blog_subtypes[0]['type_nicename'] = 'south_africa';
$blog_subtypes[0]['description'] = '';

$blog_subtypes[1]['name'] = 'Eastern Cape';
$blog_subtypes[1]['nicename'] = 'eastern_cape';
$blog_subtypes[1]['type_nicename'] = 'south_africa';
$blog_subtypes[1]['description'] = '';

//.... 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'
[ Back ]
Posted on Tuesday, November 17th, 2009, Filed under Content Management System (CMS), Wordpress Multi User, mySQL, php