digitalhydra
6/28/2015 - 2:40 AM

limitexcerpt.php

<?php
function string_limit_words($string, $word_limit)
{
  $words = explode(' ', $string, ($word_limit + 1));
  if(count($words) > $word_limit)
  array_pop($words);
  return implode(' ', $words);
}
?>
Next, put the following piece of code in your template where you want to display the excerpt:

<?php
  $excerpt = get_the_excerpt();
  echo string_limit_words($excerpt,25);
?>