Skip to content

Instantly share code, notes, and snippets.

@isaumya
Created September 19, 2016 15:16
Show Gist options
  • Save isaumya/f31123cba63341281c22f3f5017343a7 to your computer and use it in GitHub Desktop.
Save isaumya/f31123cba63341281c22f3f5017343a7 to your computer and use it in GitHub Desktop.
Count the total number of paragraph on any WordPress blog post
<?php
function __check_paragraph_count_blog( $content ) {
global $post;
if ( $post->post_type == 'post' ) {
$count = substr_count( $content, '</p>' );
return $count;
} else {
return 0;
}
}
@crawlynoob
Copy link

nice !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment