function prepare_excerpt($length, $r) { $text = trim($r->post_excerpt); if ($text == "") { $text = str_replace(']]>', ']]>', $r->post_content); $text = strip_tags($text); } $text = gdFunctionsGDSR::trim_to_words($text, $length); return $text; }