bp_activity_get_embed_excerpt

Generates excerpt for an activity embed item.

Description

(string) bp_activity_get_embed_excerpt( (string) $content = '' ); 

Returns (string)

Parameters (1)

0. $content — Optional. (string) => ''
The content to generate an excerpt for.

Usage

  1. if ( !function_exists( 'bp_activity_get_embed_excerpt' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-activity/bp-activity-embeds.php'; 
  3.  
  4. // The content to generate an excerpt for. 
  5. $content = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_activity_get_embed_excerpt($content); 
  9.  

Defined (1)

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

/bp-activity/bp-activity-embeds.php  
  1. function bp_activity_get_embed_excerpt( $content = '' ) { 
  2. if ( empty( $content ) && ! empty( $GLOBALS['activities_template']->in_the_loop ) ) { 
  3. $content = $GLOBALS['activities_template']->activity->content; 
  4.  
  5. /** 
  6. * bp_activity_truncate_entry() includes the 'Read More' link, which is why 
  7. * we're using this instead of bp_create_excerpt(). 
  8. */ 
  9. $content = html_entity_decode( $content ); 
  10. $content = bp_activity_truncate_entry( $content, array( 
  11. 'html' => false,  
  12. 'filter_shortcodes' => true,  
  13. 'strip_tags' => true,  
  14. 'force_truncate' => true 
  15. ) ); 
  16.  
  17. /** 
  18. * Filter the activity embed excerpt. 
  19. * @since 2.6.0 
  20. * @var string $content Embed Excerpt. 
  21. * @var string $unmodified_content Unmodified activity content. 
  22. */ 
  23. return apply_filters( 'bp_activity_get_embed_excerpt', $content, $GLOBALS['activities_template']->activity->content );