Created
March 21, 2011 20:13
-
-
Save timwco/880123 to your computer and use it in GitHub Desktop.
Wordpress - Get # of Posts and Round to Nearest Hundred
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 | |
function get_rounded_number_of_posts() { | |
$count_posts = wp_count_posts(); | |
$numposts = $count_posts->publish; | |
if (strlen($numposts)<3) { | |
$numposts = $numposts; | |
} else { | |
$numposts=substr($numposts, 0, strlen($numposts)-2) . "00"; | |
} | |
return $numposts; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment