buddyboss_global_search_activity_intro

Returns a trimmed activity content string.

Description

buddyboss_global_search_activity_intro( (int) $character_limit = 50 ); 

Must be used while inside activity loop

Parameters (1)

0. $character_limit — Optional. (int) => 50
The character limit.

Usage

  1. if ( !function_exists( 'buddyboss_global_search_activity_intro' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress-global-search/includes/functions.php'; 
  3.  
  4. // The character limit. 
  5. $character_limit = 50; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = buddyboss_global_search_activity_intro($character_limit); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/functions.php  
  1. function buddyboss_global_search_activity_intro( $character_limit=50 ) { 
  2. $content = ''; 
  3. if ( bp_activity_has_content() ) { 
  4. $content = bp_get_activity_content_body(); 
  5.  
  6. if( $content ) { 
  7. $content = wp_strip_all_tags( $content, true ); 
  8.  
  9. $shortened_content = substr( $content, 0, $character_limit); 
  10. if( strlen($content)> $character_limit ) 
  11. $shortened_content .= '...'; 
  12.  
  13. $content = $shortened_content; 
  14.  
  15. return apply_filters( 'buddyboss_global_search_activity_intro', $content );