Skip to main content
0
Wordpress

Limit WordPress Content

function content($limit,$content) {
  $content = explode(‘ ‘, $content, $limit);
  if (count($content)>=$limit) {
    array_pop($content);
    $content = implode(» «,$content).’…’;
  } else {
    $content = implode(» «,$content);
  }
  $content = preg_replace(‘/[.+]/’,», $content);
  $content = apply_filters(‘the_content’, $content);
  $content = str_replace(‘]]>’, ‘]]>’, $content);
  return $content;
}

0 Reviews

There are no reviews yet.