Count post views without wordpress plugin

how to display your posts words count in wordpress

WordPress tutorial, how to display your posts words count in wordpress. Here in this article we given code for adding in your theme functions.php file.

how to display your posts words count in wordpress

 

how to display your posts words count in wordpress
how to display your posts words count in wordpress

If you want to display the words count in your post. you should use the following code in functions.php file.

If you are not wordpress developer then dont use this code in your theme files.

function wcount(){
 ob_start();
 the_content();
 $content = ob_get_clean();
 return sizeof(explode(" ", $content));
}

 

In single.php file put following code for showing the word count.


echo wcount();

 

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

Leave a Reply

Your email address will not be published.