/** * Sets the length for the excerpt, * then it adds the WP filter * And automatically calls the_excerpt(); * * @param string $new_length * @return void * */ public static function length($new_length = 55) { Excerpt::$length = $new_length; add_filter('excerpt_length', 'Excerpt::new_length', 999); add_filter('excerpt_more', 'Excerpt::excerpt_more', 999); Excerpt::output(); }
function theme_excerpt($length = 55, $show = true) { if ($show) { $result = new Excerpt($length); $result->output(); } else { $result = new Excerpt($length); return $result->return_out(); } }