'widget_fmm_wpmu_recent_entries', 'description' => __( "The most recent posts from the blog of your choosing.") ); $this->WP_Widget('fmm-recent-posts', __('FMM Recent Posts'), $widget_ops); $this->alt_option_name = 'widget_fmm_recent_entries'; add_action( 'save_post', array(&$this, 'flush_widget_cache') ); add_action( 'deleted_post', array(&$this, 'flush_widget_cache') ); add_action( 'switch_theme', array(&$this, 'flush_widget_cache') ); } function widget($args, $instance) { global $wpdb; $cache = wp_cache_get('widget_fmm_wpmu_recent_entries', 'widget'); if ( !is_array($cache) ) $cache = array(); if ( isset($cache[$args['widget_id']]) ) { echo $cache[$args['widget_id']]; return; } ob_start(); extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title']); if ( !$number = (int) $instance['number'] ) $number = 10; else if ( $number < 1 ) $number = 1; else if ( $number > 15 ) $number = 15; if ( !$blog_id = (int) $instance['blog_id'] ) $blog_id = 1; $blog_string = 'wp_'.$blog_id.'_posts'; $counter = 0; $query_results = $wpdb->get_results("SELECT ID FROM $blog_string WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC"); if ($query_results) : ?>