I have found the following piece of code in the WP Knowledge Base theme in order to show subcategories of a parent category. The problem is that this only works for the first level of hierarchy, so I wanted to change the if clause in order to check if the current category has children but I have no clue how to do that, any idea? Thanks
global $term_meta, $cat, $cat_id, $wp_query;
// Check if the current category is not a first level category
// This will happen if the current category does not have any child
// If this is the case, then we simply show all it's posts
// Instead of the nice knowledgebase type things
if ( $cat->parent != '0' ) {
Aucun commentaire:
Enregistrer un commentaire