$max_characters ) { # Truncate $text to $max_characters + 1 $text = mb_substr( $text, 0, $max_characters + 1 ); # Truncate to the last space in the truncated string $text = trim( mb_substr( $text, 0, strrpos( $text, ' ' ) ) ); } return $text; } /** * Return content stripped down and limited content. * * @since 1.0.0 */ function get_the_content_limit( $max_characters, $more_link_text = '(more...)', $stripteaser = false ) { $content = get_the_content( '', $stripteaser ); # Strip tags and shortcodes so the content truncation count is done correctly $content = strip_tags( strip_shortcodes( $content ), apply_filters( 'get_the_content_limit_allowedtags', '