Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Recent Site Wide Posts & blog posts in activity : limit excerpt


grosbouff
Participant

@grosbouff

Here’s what I did :

function my_excerpts($content = false) {

// If is the home page, an archive, or search results

//if(is_front_page() || is_archive() || is_search()) :

$content = strip_shortcodes($content);

$content = str_replace(‘]]>’, ‘]]>’, $content);

$content = strip_tags($content);

$excerpt_length = 20;

$words = explode(‘ ‘, $content, $excerpt_length + 1);

if(count($words) > $excerpt_length) :

array_pop($words);

array_push($words, ‘…’);

$content = implode(‘ ‘, $words);

endif;

$content = ‘<p>’ . $content . ‘</p>’;

//endif;

// Make sure to return the content

return $content;

}

add_filter(‘bp_create_excerpt’, ‘my_excerpts’);

(it works, but I don’t know how to limit this to the activity only….well, I don’t need it for the moment.)

Skip to toolbar