/** * Get children category * * @return {array} List of category objects * * $category->term_id * $category->name * $category->slug * $category->term_group * $category->term_taxonomy_id * $category->taxonomy * $category->description * $category->parent * $category->count * $category->cat_ID * $category->category_count * $category->category_description * $category->cat_name * $category->category_nicename * $category->category_parent */ function appcropolis_get_category_children ($cat_slug='templates', $params=null) { $cat_parent = get_category_by_slug($cat_slug); if(!isset($cat_slug) || $cat_parent === false) { return false; } $defaults = array( 'type' => 'post', 'child_of' => $cat_parent->cat_ID, 'parent' => '', 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 1, 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'number' => '', 'taxonomy' => 'category', 'pad_counts' => false ); if(isset($params) && is_array($params)) { $args = array_replace($defaults, $params); } else { $args = $defaults; } $categories = get_categories( $args ); return $categories; }