#5393 closed enhancement (fixed)
Introduce new filter in bp_get_group_description_excerpt() for setting the excerpt_length
Reported by: | lenasterg | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 2.0 | Priority: | low |
Severity: | minor | Version: | 1.9.2 |
Component: | Groups | Keywords: | |
Cc: |
Description
Setting the length of group description excerpt isn't easy if you want to keep the output format of bp_create_excerpt().
It can be more easier for theme developers, by setting the length using a filter (similar to the bp_activity_excerpt_length filter).
Attached is the suggested filter addition.
Attachments (1)
Change History (5)
#1
@
11 years ago
- Milestone changed from Awaiting Review to 2.0
I'd rather not set a precedent of creating a specific filter for excerpt_length every time we call bp_create_excerpt()
.
What we can do to make this easier for you is to pass the $group object along to the filter. So then you can do this:
function bbg_custom_group_description_excerpt( $excerpt, $group ) { $excerpt = bp_create_excerpt( $group->description, 100 ); } add_filter( 'bp_get_group_description_length', 'bbg_custom_group_description_excerpt', 10, 2 );
#2
@
11 years ago
- Owner set to boonebgorges
- Resolution set to fixed
- Status changed from new to closed
In 7865:
#3
@
11 years ago
Thanks boonebgorges!
Just a small note to be sure. In your example you mean:
function bbg_custom_group_description_excerpt( $excerpt, $group ) { $excerpt = bp_create_excerpt( $group->description, 100 ); return $excerpt; } add_filter( 'bp_get_group_description_excerpt', 'bbg_custom_group_description_excerpt', 10, 2 );
which is working OK with the changes you made in 7865.
P.S.
You are great!!!
New filter bp_group_description_excerpt_length