Beispiel #1
0
 public function test_word_limiter()
 {
     $this->assertEquals('WordPress is web software...', Str::word_limiter('WordPress is web software you can use to create a beautiful website or blog.', 4));
     $this->assertEquals('WordPress is...', wpdevsclub_word_limiter('WordPress is web software you can use to create a beautiful website or blog.', 2));
 }
Beispiel #2
0
 /**
  * Renders the Content
  *
  * @since 1.0.1
  *
  * @param string    $content
  * @param string    $view
  * @param bool      $wpautop
  * @param bool|int  $word_limiter
  * @return string
  */
 public function render_content($content, $view = '', $wpautop = true, $word_limiter = false)
 {
     $content = do_shortcode($content);
     if ($word_limiter) {
         $word_limiter = is_numeric($word_limiter) ? $word_limiter : 30;
         $content = wpdevsclub_word_limiter($content, $word_limiter);
     }
     if ($wpautop) {
         $content = wpautop($content);
     }
     if ($view) {
         $this->load_view($view, compact('content'));
     } else {
         echo wp_kses_post($content);
     }
 }