/ Published in: PHP

Returns the number of published posts in the given category.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// @ 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; } } //----------------------------------------------------------
Comments
