[wp-hackers] WP 3 Multisite List Blogs
Christopher Ross
cross at thisismyurl.com
Sun Aug 1 15:07:22 UTC 2010
I'd agree with you Otto, while it's not a function I'd like to call on every page it doesn't seem to be that heavy a call.
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 );
}
On 2010-08-01, at 11:21 AM, Otto wrote:
> You know, get_blog_list doesn't look like it'd be so bad if you turned
> off the postcount queries.
>
> -Otto
__
Christopher Ross
Toronto 1 (416) 840-5828
Fredericton 1 (506) 474-2708
New Orleans 1 (504) 322 3485
http://christopherross.ca
http://www.thisismyurl.com
More information about the wp-hackers
mailing list