how to list the url of all child blogs in a multi site

source : wp-hackers digest # 67,6,3.

After I was pointed to it, I did some light modifications and added it to my functions file. Here's the results :

function cr_get_blog_list( $start = 0, $num = 10) {
global $wpdb;
$blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A );

foreach ( (array) $blogs as $details ) {$blog_list[ $details['blog_id'] ] = $details;}
unset( $blogs );
$blogs = $blog_list;

if ( false == is_array( $blogs ) )
return array();
if ( $num == 'all' )
return array_slice( $blogs, $start, count( $blogs ) );
else
return array_slice( $blogs, $start, $num );
}
 
 
Creative Commons License
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
 
 

0 comments :: how to list the url of all child blogs in a multi site

Post a Comment