Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Excerpt function in RC2


Burt Adsit
Participant

@burtadsit

I see what you are saying. You want to be able to display an excerpt of the group description in the group directory. The best way I can recommend to you is to create a filter in bp-custom.php. Create one if it doesn’t exist in the bp /plugins/buddypress directory. This is a file where you can put all your custom mods for bp. In there, stick the following code:

function my_group_directory_description($text){

global $site_groups_template;

// only filter the description in the groups directory

if ($site_groups_template)

return bp_create_excerpt($text, 50);

else

return $text;

}

add_filter(‘bp_group_description’,’my_group_directory_description’)

That hooks a filter for the group description only when in the group directory and limits the work count to 50. You can modify the number of words limit by changing ’50’ to whatever word count you want.

The number of lines can’t be calculated easily. Too many variables. The bp_create_excerpt() function works by word count.

Skip to toolbar