can i get posts along with the list?
For getting all the posts, you have to use a different plugin. Like I mentioned in the other thread you responded to.
http://wordpress.org/extend/plugins/wordpress-mu-sitewide-tags/
Hi Andrea,
I am using same plugin for my website. But stuck up at the point where you need to add some loop to home page. to fetch all posts in that page.
Basically i want to have a home page like wordpress.com. with latest updated post from various blogs.
Regards,
Sam.
You do not need to add a loop anywhere. Just use a regular theme.
How strange. I just followed the link that Andrea_r posted, and that plugin page appears to be broken. Instead of a download button, there’s just a red bar. Is anyone else seeing that?
Yes, I see the same problem π Can’t download the plugin.
I just submitted the bug. Also, the menu tabs (Description, FAQ, etc.) are missing.
They’re mucking with the plugin database. It could be related to that. I’ll drop ’em a note (’em being ’em what’re mucking with the DB).
Yep. Looks like it’s fixed.
Magic. Remember to thank Otto and tip your waiter.
Here’s a function that works with version 3.1
function get_all_sites() {
global $wpdb;
// Query all blogs from multi-site install
$blogs = $wpdb->get_results("SELECT blog_id,domain,path FROM wp_blogs where blog_id > 1 ORDER BY path");
// Start unordered list
echo '<ul>';
// For each blog search for blog name in respective options table
foreach( $blogs as $blog ) {
// Query for name from options table
$blogname = $wpdb->get_results("SELECT option_value FROM wp_".$blog->blog_id ."_options WHERE option_name='blogname' ");
foreach( $blogname as $name ) {
// Create bullet with name linked to blog home pag
echo '<li>';
echo '<a href="http://';
echo $blog->domain;
echo $blog -> path;
echo '">';
echo $name->option_value;
echo '</a></li>';
}
}
// End unordered list
echo '</ul>';
}
You might need to change the http:// or the database name based on your settings.
@leopardo…thanks a bunch. I modified your function slightly to be a little more abstract.
if(!function_exists('get_all_sites')){
/**
* Retrieves all multisite blogs
*
* @return array Blog IDs as keys and blog names as values.
*/
function get_all_sites() {
global $wpdb;
$multisite = array();
// Query all blogs from multi-site install
$blogs = $wpdb->get_results("SELECT blog_id,domain,path FROM wp_blogs ORDER BY path");
// Get primary blog
$blogname = $wpdb->get_row("SELECT option_value FROM wp_options WHERE option_name='blogname' ");
$multisite[1] = $blogname->option_value;
// For each blog search for blog name in respective options table
foreach( $blogs as $blog ) {
// Get rest of the sites
$blogname = $wpdb->get_results("SELECT option_value FROM wp_".$blog->blog_id ."_options WHERE option_name='blogname' ");
foreach( $blogname as $name ) {
$multisite[$blog->blog_id] = $name->option_value;
}
}
return $multisite;
}
}
Glad it helped. Thanks for building upon it.