Display all sub-category
-
I made a custom post type and a taxonomy with pods. My custom post type is call books and category_books is my taxonomy. I have novel, biography and comics as category. Both novel and comics have children.
books - novel - sci-fi - fantasy - biography - comics - marvel - dc comicI also have a side menu that display category_books as a navigation menu. When I click on a term it redirect to a page that list every books with that term as category. The problem is that I use $term->name to display my list and novel and comics show nothing since my post are link with their children.
$params = array( 'limit' => -1, 'where' => 'category_books.name LIKE "%' . $term->name . '%"' );Is there a way to look if a term have a child and if it does then list all their post? I want to do something like: if I click on novel it would list all the post link with sci-fi and fantasy and if I click on sci-fi it show normaly (just sci-fi).
The topic ‘Display all sub-category’ is closed to new replies.