[Resolved] Conditional statement including category AND child-categories
I’m trying to do a conditional statement to assign a specific style to a category and all its child categories.
<h1 class="page-title <?php if (is_category('Édition')) : echo 'edition'; elseif (is_category('Auto-publication')) : echo 'autopublication'; else : echo 'categorytitle'; endif; ?>"> <? echo single_cat_title( '', false ) ; ?></h1>
Basically, I have a bunch of child categories for each category (the code is only to test it, I have 6 categories and about 6 subcategory for each category). The point would be for example to have if (is_category(‘Édition’)) and “all of its child categories”, blablabla…
I’m looking for the code to call “all of its child categories”. If I wanted a list or something, I could do it, but I’m not sure it would be ok here. Is there a way to say if “child category of Édition” ?
- The topic ‘[Resolved] Conditional statement including category AND child-categories’ is closed to new replies.