Show first paragraph content

0 0 0 0 0

In this article you learn that how you show first paragraph content on page or post
Please check the below code snippet –

$content = apply_filters( ‘the_content’, get_the_content() );

$text = substr( $content, 0, strpos( $content, ‘</p>’ ) + 4 );

$final_text = preg_replace(“/<img[^>]+\>/i”, “”, $text);

echo $final_text;

Leave a Reply

Your email address will not be published. Required fields are marked *