Support » Fixing WordPress » Limit Character Count in the_content; keep MORE link

  • sergibosch

    (@sergibosch)


    i found this post in the forum that explained how to reduct the character count.

    however, the “More” attribute disappears. How can i include the “More” link while incorporating this function?

    thanks!

    function content($num) {
    $theContent = get_the_content();
    $output = preg_replace('/<img[^>]+./','', $theContent);
    $output = preg_replace( '/<blockquote>.*<\/blockquote>/', '', $output );
    $output = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $output );
    $limit = $num+1;
    $content = explode(' ', $output, $limit);
    array_pop($content);
    $content = implode(" ",$content)."...";
    echo $content;
    }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Limit Character Count in the_content; keep MORE link’ is closed to new replies.