<?php
function my_excerpt($excerpt, $maxLength = 200){
$excerpt = preg_replace(" (\[.*?\])",'',$excerpt);
$excerpt = strip_shortcodes($excerpt);
$excerpt = strip_tags($excerpt);
$fullLength = strlen($excerpt);
$excerpt = substr($excerpt, 0, $maxLength);
$excerpt = substr($excerpt, 0, strripos($excerpt, " "));
$excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt));
if($fullLength > $maxLength) {
$excerpt = $excerpt.'...';
}
return $excerpt;
}