function bp_get_the_site_blog_latest_post() { global $site_blogs_template; if ($post = bp_blogs_get_latest_posts($site_blogs_template->blog->blog_id, 1)) { return apply_filters('bp_get_the_site_blog_latest_post', sprintf(__('Latest Post: %s', 'buddypress'), '<a href="' . bp_post_get_permalink($post[0], $site_blogs_template->blog->blog_id) . '">' . apply_filters('the_title', $post[0]->post_title) . '</a>')); } }
function bp_blogs_widget_recent_posts($args) { global $current_blog; extract($args); $options = get_blog_option($current_blog->blog_id, 'bp_blogs_widget_recent_posts'); ?> <?php echo $before_widget; ?> <?php echo $before_title . $widget_name . $after_title; ?> <?php $posts = bp_blogs_get_latest_posts(null, $options['max_posts']); ?> <?php $counter = 0; ?> <?php if ($posts) { ?> <div class="item-options" id="recent-posts-options"> <?php _e("Site Wide", 'buddypress'); ?> </div> <ul id="recent-posts" class="item-list"> <?php foreach ($posts as $post) { ?> <li> <div class="item-avatar"> <a href="<?php echo bp_post_get_permalink($post, $post->blog_id); ?> " title="<?php echo apply_filters('the_title', $post->post_title); ?> "><?php echo bp_core_get_avatar($post->post_author, 1); ?> </a> </div> <div class="item"> <h4 class="item-title"><a href="<?php echo bp_post_get_permalink($post, $post->blog_id); ?> " title="<?php echo apply_filters('the_title', $post->post_title); ?> "><?php echo apply_filters('the_title', $post->post_title); ?> </a></h4> <?php if (!$counter) { ?> <div class="item-content"><?php echo bp_create_excerpt($post->post_content); ?> </div> <?php } ?> <div class="item-meta"><em><?php printf(__('by %s from the blog <a href="%s">%s</a>', 'buddypress'), bp_core_get_userlink($post->post_author), get_blog_option($post->blog_id, 'siteurl'), get_blog_option($post->blog_id, 'blogname')); ?> </em></div> </div> </li> <?php $counter++; ?> <?php } ?> </ul> <?php } else { ?> <div class="widget-error"> <?php _e('There are no recent blog posts, why not write one?', 'buddypress'); ?> </div> <?php } ?> <?php echo $after_widget; }