How to just show first line of content

you could also do something like:

function rt_before_after($content) {

 $replace = "</b>";
 $shortcontent = strstr($content, $replace, true).$replace;

 if ($shortcontent === false) $shortcontent = $content;

    return $shortcontent;
}
add_filter('the_content', 'rt_before_after');

It should look for the first </b> in your content and return everything before that. it then adds the </b> back. The function takes that string and replaces your content.

Leave a Comment