post_is_in_descendant_category Help
-
I tried this from the codex page:
post_is_in_descendant_categoryMy Code:
<?php if ( is_category( 'portfolio' ) || post_is_in_descendant_category( 12 ) ) : ?>
I have it so that any posts in the parent category of “Portfolio” and in sub categories of this parent, will use a different template I created. The code above works, but the problem is that I cannot use the ID, it must be a name “Portfolio”. There is an example if one wants to use names, but it’s simply not working for me. Is there a way to use the name and not the ID?
I’m making a theme for others to use so using an ID that will more likely be different for each user is not viable here. My setup tutorial will instruct them to name the parent category (if they have other cats) as “Portfolio” to make this easier.
Thanks in advance.
- The topic ‘post_is_in_descendant_category Help’ is closed to new replies.