inkthemes_trim_excerpt

The Black Rider Lite Responsive Theme inkthemes trim excerpt function.

Description

inkthemes_trim_excerpt( $length ); 

Parameters (1)

0. $length
The length.

Usage

  1. if ( !function_exists( 'inkthemes_trim_excerpt' ) ) { 
  2. require_once '/functions/inkthemes-functions.php'; 
  3.  
  4. // The length. 
  5. $length = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = inkthemes_trim_excerpt($length); 
  9.  

Defined (1)

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

/functions/inkthemes-functions.php  
  1. function inkthemes_trim_excerpt($length) { 
  2. global $post; 
  3. $explicit_excerpt = $post->post_excerpt; 
  4. if ('' == $explicit_excerpt) { 
  5. $text = get_the_content(''); 
  6. $text = apply_filters('the_content', $text); 
  7. $text = str_replace(']]>', ']]>', $text); 
  8. } else { 
  9. $text = apply_filters('the_content', $explicit_excerpt); 
  10. $text = strip_shortcodes($text); // optional 
  11. $text = strip_tags($text); 
  12. $excerpt_length = $length; 
  13. $words = explode(' ', $text, $excerpt_length + 1); 
  14. if (count($words) > $excerpt_length) { 
  15. array_pop($words); 
  16. array_push($words, '[…]'); 
  17. $text = implode(' ', $words); 
  18. $text = apply_filters('the_excerpt', $text); 
  19. return $text;