Use a custom excerpt in the Activity Stream for blog posts
Sometimes you want to have full control over the excerpt that is shown in the activity stream when you publish a new post for your readers. R-A-Y from BuddyPress.org has created a simple snippet which gives you back control over how the excerpt will be displayed in new Blog Post entries. Here’s the code:
Place the following in your child themes functions.php file, or in bp-custom.php:
function my_bp_post_excerpt($activity_content, $post, $permalink) { if($post->post_excerpt) return $post->post_excerpt; else return $activity_content; } add_filter( 'bp_blogs_activity_new_post_content', 'my_bp_post_excerpt', 1, 3 );
Done!
Looking for quality BuddyPress hosting? We will guide you through all the available hosting options and help you find the best webhost for your next BuddyPress project!
thx, exactly what i needed!
your welcome!
I am a lover of buddypress . i have a question please give me a suggestion. whenever a user publish a new blog post , full post is displayed in activity stream. if a post is lengthy it does not looks good in activity stream. i want to to display a paragraph or just title of lengthy post in activity stream instead of full post. how can i do that.
Is there a way to change the activity content excerpt: shorten, lengthen, or remove it entirely if you only wanted to blog title to show up in the activity feed. I assume it might be done with some variation of this code, replacing the else return activity_content with none somehow.
added to functions.php and all posts appeared blank.