Display last updated N blogs in WPMU

To display last N updated blogs in WordPress MU main page, just add code below to the sidebar.php of your theme:

<?php
$blogs = get_last_updated();
$blog_limit=10;
if( is_array( $blogs ) ) {
?>
<ul>
<?php
foreach( $blogs as $details ) {
$blog_limit = $blog_limit-1;
if ($blog_limit < 0 ) continue;
?><li><div class=”blogslinks”><a target=”_BLANK” href=”http://<?php echo $details[ ‘domain’ ] . $details[ ‘path’ ] ?>”><?php echo get_blog_option( $details[ ‘blog_id’ ], ‘blogname’ ) ?></a></div></li><?php
}
?>
</ul>
<?php
}
?>

You can set $blog_limit to 10 or whatever you want.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.