Skip to content

Instantly share code, notes, and snippets.

@timwco
Created March 21, 2011 20:13
Show Gist options
  • Save timwco/880123 to your computer and use it in GitHub Desktop.
Save timwco/880123 to your computer and use it in GitHub Desktop.
Wordpress - Get # of Posts and Round to Nearest Hundred
<?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