1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
/** * 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; } |