How to get child categories by id?
-
The code below is part of a block of code I’m using in a custom category template to display child categories of the current category. Instead of getting all the child categories I would like to filter them by id, name or slug. Can anyone tell me how to do this?
$catpage = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; $catnum = 5; $offset = ($catnum * $catpage) - 5; $cat = get_category( get_query_var( 'cat' ) ); $cat_id = $cat->cat_ID; get_categories( array( 'parent' => $cat_id, 'orderby' => 'id', 'order' => 'DESC', 'hide_empty' => '0', 'number' => $catnum, 'offset' => $offset, 'paged' => $catpage ) );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to get child categories by id?’ is closed to new replies.