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
01 | function paragraph_show( $paragraph_number , $post_content ){ |
02 | $show_after_paragraph_tag = 1; |
03 | $paragraph_number = $paragraph_number - 1; |
05 | $content = apply_filters( 'the_content' , $post_content ); |
07 | if (substr_count( $content , ' |
09 | ') > $show_after_paragraph_tag ) |
19 | foreach ( $contents as $content ) |
22 | if ( $paragraph_number == $p_count ){ |
We can use this function like this.
In while loop you can use or paste following code
1 | #This will show the first paragraph of post. |