jetpack_blog_display_custom_excerpt

Apply Content filters.

Description

jetpack_blog_display_custom_excerpt( $content ); 

Parameters (1)

0. $content
The content.

Usage

  1. if ( !function_exists( 'jetpack_blog_display_custom_excerpt' ) ) { 
  2. require_once '/modules/theme-tools/content-options/blog-display.php'; 
  3.  
  4. // The content. 
  5. $content = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = jetpack_blog_display_custom_excerpt($content); 
  9.  

Defined (1)

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

/modules/theme-tools/content-options/blog-display.php  
  1. function jetpack_blog_display_custom_excerpt( $content ) { 
  2. $post = get_post(); 
  3. if ( empty( $post->post_excerpt ) ) { 
  4. $text = strip_shortcodes( $post->post_content ); 
  5. $text = str_replace( ']]>', ']]>', $text ); 
  6. $text = strip_tags( $text ); 
  7. /** This filter is documented in wp-includes/formatting.php */ 
  8. $excerpt_length = apply_filters( 'excerpt_length', 55 ); 
  9. /** This filter is documented in wp-includes/formatting.php */ 
  10. $excerpt_more = apply_filters( 'excerpt_more', ' ' . '[...]' ); 
  11.  
  12. /** 
  13. * translators: If your word count is based on single characters (e.g. East Asian characters),  
  14. * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. 
  15. * Do not translate into your own language. 
  16. */ 
  17. if ( strpos( _x( 'words', 'Word count type. Do not translate!' ), 'characters' ) === 0 && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) { 
  18. $text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' ); 
  19. preg_match_all( '/./u', $text, $words ); 
  20. $words = array_slice( $words[0], 0, $excerpt_length + 1 ); 
  21. $sep = ''; 
  22. } else { 
  23. $words = preg_split( "/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY ); 
  24. $sep = ' '; 
  25.  
  26. if ( count( $words ) > $excerpt_length ) { 
  27. array_pop( $words ); 
  28. $text = implode( $sep, $words ); 
  29. $text = $text . $excerpt_more; 
  30. } else { 
  31. $text = implode( $sep, $words ); 
  32. } else { 
  33. $text = wp_kses_post( $post->post_excerpt ); 
  34. return sprintf( '<p>%s</p>', $text );