In this article we given code for Fetch the wordpress post paragraph number wise. created One function for fetching the wordpress post as per p tag number.
Fetch the wordpress post paragraph number wise
# You can Use this function for showing
function paragraph_show($paragraph_number, $post_content){
$show_after_paragraph_tag = 1;
$paragraph_number= $paragraph_number - 1;
//echo $paragraph_number;
$content = apply_filters('the_content', $post_content);
if(substr_count($content, '
') > $show_after_paragraph_tag)
//echo substr_count($content, '
');
{
$contents = explode("
", $content);
$p_count = 0;
foreach($contents as $content)
{
//echo $p_count;
if($paragraph_number == $p_count){
echo $content;
}
$p_count++;
}
}
}
We can use this function like this.
In while loop you can use or paste following code
#This will show the first paragraph of post. post_content);
