/** * 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 __construct($length) { Excerpt::$length = $length; add_filter('excerpt_length', array('Excerpt', 'new_length')); }