bbp_get_reply_excerpt( int $reply_id, int $length = 100 )
Return the excerpt of the reply
Description
Parameters
- $reply_id
-
(Optional) Reply id
- $length
-
(Optional) Length of the excerpt. Defaults to 100 letters
Default value: 100
Return
(string) Reply Excerpt
Source
File: bp-forums/replies/template.php
659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 | function bbp_get_reply_excerpt( $reply_id = 0, $length = 100 ) { $reply_id = bbp_get_reply_id( $reply_id ); $length = (int) $length ; $excerpt = get_post_field( 'post_excerpt' , $reply_id ); if ( empty ( $excerpt ) ) { $excerpt = bbp_get_reply_content( $reply_id ); } $excerpt = trim ( strip_tags ( $excerpt ) ); // Multibyte support if ( function_exists( 'mb_strlen' ) ) { $excerpt_length = mb_strlen( $excerpt ); } else { $excerpt_length = strlen ( $excerpt ); } if ( ! empty ( $length ) && ( $excerpt_length > $length ) ) { $excerpt = substr ( $excerpt , 0, $length - 1 ); $excerpt .= '…' ; } return apply_filters( 'bbp_get_reply_excerpt' , $excerpt , $reply_id , $length ); } |
Changelog
Version | Description |
---|---|
bbPress (r2751) | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.