Wordpress

Limit WordPress Content

By febrero 6, 2017 mayo 31st, 2020 No Comments

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

Leave a Reply