Created
October 16, 2013 12:38
Revisions
-
mkwebworker renamed this gist
Oct 16, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
mkwebworker created this gist
Oct 16, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ /** * count_categorie_items :: count all items of a category :: returns false or the number of items * @param string $category_slug :: slug of the category * @param bool return :: return or echo **/ function count_categorie_items( $category_slug, $return = false){ if( ! empty ($category_slug) ): ///// get category id & count their items ///// $cat = get_category_by_slug($category_slug); $args = array ( 'post_type' => 'post', 'posts_per_page' => -1, 'category' => $cat->term_id ); $press_releases_items = count( get_posts($args) ); ///// return or echo ///// if($return == true )return $press_releases_items; else echo $press_releases_items; else: return false; endif; }