Created
February 16, 2012 15:03
-
-
Save sbruner/1845471 to your computer and use it in GitHub Desktop.
Custom BuddyPress Activity Stream
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* = Generate Custom Activity Stream | |
----------------------------------------------- | |
* Place this function anywhere you want to show your custom stream. | |
* Should accept any of these parameters: | |
* http://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-activity-stream-loop/ | |
*/ | |
my_activity_stream('per_page=4&page=1&action=new_forum_post,new_blog_comment,new_blog_post,new_forum_topic'); | |
/* = Custom Activity Stream | |
----------------------------------------------- | |
* Place this function in bp-custom.php (in your plugins directory) | |
*/ | |
function my_activity_stream($args ) { | |
if ( bp_has_activities($args) ) : ?> | |
<div class="pagination"> | |
<div class="pag-count"><?php bp_activity_pagination_count() ?></div> | |
<div class="pagination-links"><?php bp_activity_pagination_links() ?></div> | |
</div> | |
<ul id="activity-stream" class="activity-list item-list"> | |
<?php while ( bp_activities() ) : bp_the_activity(); ?> | |
<li class="<?php bp_activity_css_class() ?>" id="activity-<?php bp_activity_id() ?>"> | |
<div class="activity-avatar"> | |
<a href="<?php bp_activity_user_link() ?>"> | |
<?php bp_activity_avatar( 'type=full&width=100&height=100' ) ?> | |
</a> | |
</div> | |
<div class="activity-content"> | |
<div class="activity-header"> | |
<?php bp_activity_action() ?> | |
</div> | |
<?php if ( bp_get_activity_content_body() ) : ?> | |
<div class="activity-inner"> | |
<?php bp_activity_content_body() ?> | |
</div> | |
<?php endif; ?> | |
<?php do_action( 'bp_activity_entry_content' ) ?> | |
</div> | |
</li> | |
<?php endwhile; ?> | |
</ul> | |
<?php else : ?> | |
<div id="message" class="info"> | |
<p><?php _e( 'Sorry, there was no activity found. Please try a different filter.', 'buddypress' ) ?></p> | |
</div> | |
<?php endif; | |
wp_reset_query(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment