-
-
Save jbenner-radham/ad700de0d87f44b4cf36 to your computer and use it in GitHub Desktop.
Count the total words of all posts for the year
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$words = 0; | |
$posts = query_posts([ | |
'posts_per_page' => -1, | |
'year' => '2014', | |
]); | |
foreach ($posts as $post) { | |
$words += str_word_count($post->post_content); | |
} | |
echo 'Total Words: '. number_format($words); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment