mh_excerpt

The MH Corporate basic mh excerpt function.

Description

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

Parameters (1)

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

Usage

  1. if ( !function_exists( 'mh_excerpt' ) ) { 
  2. require_once '/functions.php'; 
  3.  
  4. // The excerpt length. 
  5. $excerpt_length = '175'; 
  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).

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