Home / functions.php / Display word count
  • How to Display word count

    no thumbnail sorry: Display word count

    Adding this first PHP code snipp in your funtions.php then place the echo wcount(); within the loop of your wordpress theme and return the word count for the post.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    function wcount(){
        ob_start();
        the_content();
        $content = ob_get_clean();
        return sizeof(explode(" ", $content));
    }
    
    ( click code to copy )

    wordpress snippet : PHP

    <>
                echo wcount();
    

    ( WordPress codex functions, hooks, in this snippet. )

    the_content,

0 Comments

No comments yet.

RSS feed for comments on this post. TrackBack URI

Sorry, the comment form is closed at this time.