static function cut_title($cut_parms, $title) { //trim and get the excerpt $title = trim($title); $title = tt_excerpt($title, $cut_parms['excerpt']); //get an array of chars $title_chars = str_split($title); $buffy = ''; $current_char_on_line = 0; $has_to_cut = false; //when true, the string will be cut foreach ($title_chars as $title_char) { //check if we reached the limit if ($cut_parms['char_per_line'] == $current_char_on_line) { $has_to_cut = true; $current_char_on_line = 0; } else { $current_char_on_line++; } if ($title_char == ' ' and $has_to_cut === true) { //we have to cut, it's a white space so we ignore it (not added to buffy) $buffy .= $cut_parms['line_wrap_end'] . $cut_parms['line_wrap_start']; $has_to_cut = false; } else { //normal loop $buffy .= $title_char; } } //wrap the string return $cut_parms['line_wrap_start'] . $buffy . $cut_parms['line_wrap_end']; }
function get_excerpt($lenght = 25, $show_shortcodes = '') { if ($this->post->post_excerpt != '') { return $this->post->post_excerpt; } if (empty($lenght)) { $lenght = 25; } $buffy = ''; //print_r($this->post); $buffy .= tt_excerpt($this->post->post_content, $lenght, $show_shortcodes); return $buffy; }