WordPress.org

Ready to get started?Download WordPress

Forums

Post Excerpt - Echo script PHP Troubleshooting (1 post)

  1. TumbleweedMarketingAnalytics
    Member
    Posted 2 years ago #

    1. This is the content output code in rotating_post.php file:

    echo "<div class='rp_post_content'>{$postContent}</div>\n";

    2. How do I wrap the following code around the above statment:

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

    IF.... this is the code in my functions.php file:

    <?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);
    }
    ?>

    Thanks,

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 2 years ago by TumbleweedMarketingAnalytics
  • This topic is not resolved
  • WordPress version: 3.4