Wordpress - Short First Sentence of Post
<?php
function show_first_sentence_of_post()
{
$content = get_the_content();
$content = html_entity_decode(strip_tags(str_replace(" ", '',$content)));
$pos = strpos($content, '.');
if($pos === false) {
return $content;
}
else {
if ($pos > 250) {
$pos = 250;
$ellipsis = "...";
}
$first_sentence = substr($content, 0, $pos + 1);
return $first_sentence.$ellipsis;
}
} /* end show_first_sentence_of_post function */