hi
I am trying to make a theme for photoblog community…
I want to display site-wide recent posts on the home.php
How will i be able to do it without using the widgets ?
Will the following code up into home.php in my theme folder help ?
<?php $posts = bp_blogs_get_latest_posts( null, $instance['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 endif; ?>
<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 endforeach; ?>
</ul>
<?php else: ?>
<div class="widget-error">
<?php _e('There are no recent blog posts, why not write one?', 'buddypress') ?>
</div>
<?php endif; ?>