-
List All Your Blogs on WordPress MU
Posted by markzero on Sunday, July 10th, 2011
I had a task to list some of site’s blogs on home page of clients’ site. Then searched and couldn’t find a way to do it, so I created my own function and did it using wpdb class (again).
<?php $sites_id_query = "SELECT blog_id FROM $wpdb->blogs"; $sites_id_res = $wpdb->get_results($sites_id_query); foreach($sites_id_res as $site_id) { $site_query = "SELECT option_value FROM ".$wpdb->base_prefix.$site_id->blog_id."_options WHERE option_name='blogname'"; $site_res = $wpdb->get_results($site_query); foreach($site_res as $site_name) { ?> <span><?=$site_name->option_value?></span> <?php } } ?>
I’m sure you got this ;)
Perhaps, there are other ways, but I was in a rush, so… Hope this would be useful to some.
Posted in: Wordpress.
Share this story:
2 Responses to “List All Your Blogs on WordPress MU”
Leave a Reply
Useful Links
Categories
Archives















Hi Mark,
thanks for the code, anyway, i didn’t test it yet, but it is works? any link for sample of list all blogs wpmu.
Thanks,
Andhie
Report this comment
You can find it on submenu http://bit.ly/I06hoD in header under main menu
Report this comment