Anonymous User 18274256
(@anonymized-18274256)
Hi @amedic
You need to add the below-mentioned function in your theme’s function.php file.
function first_paragraph() {
global $post, $posts;
$post_content = $post->post_content;
$post_content = apply_filters('the_content', $post_content);
$post_content = str_replace('</p>', '', $post_content);
$paras = explode('<p>', $post_content);
array_shift($paras);
return $paras[0];
}
You need to call this function echo first_paragraph() wherever you want to display the first paragraph of the content.
Hope this helps.
Regards,
-
This reply was modified 5 years, 1 month ago by
Anonymous User 18274256.
Thread Starter
amedic
(@amedic)
Hi @ravivaddweb
thanks for the help, but unfortunately nothing is returned.
Anonymous User 18274256
(@anonymized-18274256)
Hi @amedic,
Can you please let me know did you `echo first_paragraph()’ this function?
Regards,
Thread Starter
amedic
(@amedic)
After echoing the function the whole block group is returned. Block group consists of h2, image, custom html and paragraph.