I found these.. forgot where..:(
But it generated by Tags not Category, but I think it should be easy now for modify.. isn't it andrea?
easy for u developers.. not for me.. :D
<?php
/*
Plugin Name: WordPress MU Recent Posts
Plugin URI: http://atypicalhomeschool.net/wordpress-plugins/
Description: Retrieves a list of the most recent posts in a WordPress MU installation. Based on (Andrea - fill this in)
Version: 0.3
Author: Ron Rennick
Author URI: http://atypicalhomeschool.net/
Use this by pasting the following wherever you want it to show:
<?php ah_recent_posts_mu(10) ?>
*/
function ah_recent_posts_mu($how_many = 10) {
global $wpdb;
$counter = 0;
// get a list of blogs in order of most recent update
$blogs = $wpdb->get_col("SELECT blog_id
FROM $wpdb->blogs
WHERE last_updated >= DATE_SUB(CURRENT_DATE(), INTERVAL 5 DAY)
ORDER BY last_updated DESC");
if ($blogs) {
foreach ($blogs as $blog) {
// we need _posts and _options tables for this to work
$blogOptionsTable = "wp_".$blog."_options";
$blogPostsTable = "wp_".$blog."_posts";
$blogTaxonomyTable = "wp_".$blog."_term_taxonomy";
$blogRelationshipsTable = "wp_".$blog."_term_relationships";
$blogTermsTable = "wp_".$blog."_terms";
$options = $wpdb->get_results("SELECT option_value FROM
$blogOptionsTable
WHERE option_name IN ('siteurl','blogname')
ORDER BY option_id, option_name DESC");
// we fetch the title and link for the latest post
$thispost = $wpdb->get_results("SELECT post_title, guid, post_content, post_date, user_login, $blogTaxonomyTable.term_taxonomy_id, $blogTaxonomyTable.term_id, taxonomy, $blogRelationshipsTable.term_taxonomy_id, $blogTermsTable.term_id, taxonomy, object_id, name, $blogPostsTable.ID
FROM $blogPostsTable, wp_users, $blogTaxonomyTable, $blogRelationshipsTable, $blogTermsTable
WHERE wp_users.ID = $blogPostsTable.post_author
AND $blogTermsTable.name = ''
AND post_status = 'publish'
AND taxonomy = 'post_tag'
AND post_type = 'post'
AND $blogPostsTable.ID = object_id
AND $blogTermsTable.term_id = $blogTaxonomyTable.term_id
AND $blogTaxonomyTable.term_taxonomy_id = $blogRelationshipsTable.term_taxonomy_id
AND post_date >= DATE_SUB( CURRENT_DATE( ) , INTERVAL 5 DAY )
ORDER BY $blogPostsTable.id DESC
LIMIT 0 , 1 ");
// if it is found put it to the output
if($thispost) {
// pull in the posts content from database
$desc = $thispost[0]->post_content;
// save the post date to a var
$date = strtotime($thispost[0]->post_date);
// strip out html characters to allow for truncating
$strippedDesc = strip_tags($desc);
// truncate post content to 120 words
$numwords = 120;
preg_match("/([\S]+\s*){0,$numwords}/", $strippedDesc, $regs);
$shortDesc = trim($regs[0]);
// Displays the post title url truncted text, author and blog name
echo '
<h2>guid.'">'.$thispost[0]->post_title.'</h2>
by: '.$thispost[0]->user_login.' || from: option_value.'">'.$options[1]->option_value.'
<p>'.$shortDesc.'guid.'"> [more]</p>
';
$counter++;
}
// don't go over the limit
if($counter >= $how_many) {
break;
}
}
}
}
?>