mh_excerpt

The MH Purity lite mh excerpt function.

Description

mh_excerpt( (string) $excerpt_length = '110' ); 

Parameters (1)

0. $excerpt_length — Optional. (string) => '110'
The excerpt length.

Usage

  1. if ( !function_exists( 'mh_excerpt' ) ) { 
  2. require_once '/includes/mh-functions.php'; 
  3.  
  4. // The excerpt length. 
  5. $excerpt_length = '110'; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = mh_excerpt($excerpt_length); 
  9.  

Defined (1)

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

/includes/mh-functions.php  
  1. function mh_excerpt($excerpt_length = '110') { 
  2. global $post; 
  3. $mh_purity_lite_options = mh_purity_lite_theme_options(); 
  4. $permalink = get_permalink($post->ID); 
  5. $excerpt_more = empty($mh_purity_lite_options['excerpt_more']) ? '[...]' : $mh_purity_lite_options['excerpt_more']; 
  6. $excerpt = get_the_excerpt(); 
  7. if (!has_excerpt()) { 
  8. $excerpt = substr($excerpt, 0, $excerpt_length); 
  9. $excerpt = substr($excerpt, 0, strrpos($excerpt, ' ')); 
  10. echo '<div class="mh-excerpt">' . wp_kses_post($excerpt) . ' <a href="' . $permalink . '" title="' . the_title_attribute('echo=0') . '">' . esc_attr($excerpt_more) . '</a></div>' . "\n";