Return to Snippet

Revision: 28032
at June 29, 2010 23:55 by mihael


Initial Code
// @ WordPress
// Returns the total number of posts in given category
// --------------------------------------------------------
function count_total_posts($cat) {

	foreach((get_the_category()) as $category) {
		
		if( $category->cat_ID == $cat ) return $category->category_count;

	}
	
}
//----------------------------------------------------------

Initial URL

                                

Initial Description
Returns the number of published posts in the given category.

Initial Title
WordPress: Get the posts count for given category

Initial Tags
post, wordpress

Initial Language
PHP