• Hi

    I am using my default home page, and it shows the whole article on the page. I dont want this, i want it to show maybe 50 words from each article.

    Is there any way or plugin that can help me with this problem?

Viewing 1 replies (of 1 total)
  • in your template’s functions.php put:

    function string_limit_words($string, $word_limit) {
      $words = explode(' ', $string, ($word_limit + 1));
      if(count($words) > $word_limit)
      array_pop($words);
      return implode(' ', $words);
    }

    then, in your template for the page you want, search for
    <?php the_excerpt();?> and change it to:

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

    where the 25 is the number of words you want to limit it to.

Viewing 1 replies (of 1 total)
  • The topic ‘How do I limit the amount of Text?’ is closed to new replies.