WordPress.org

Ready to get started?Download WordPress

Forums

Can't get sub-menu to display / multiple category issue (2 posts)

  1. nadine00
    Member
    Posted 2 years ago #

    How would I properly write this:

    If this single post is in the parent category [Articles] AND is in a child of [Articles] display [something]

    I have this

    <?php if ( in_category('Articles') && cat_is_ancestor_of(4) ) {
    	echo 'yes';
    }else {
    	echo 'no';
    }?>

    Why I'm trying to figure this out. I have a sub-categories for 'Articles' that display as a side navigation. If I am on a single post page where that post is in both 'Articles' and say 'Reviews' The Articles sub-nav dissapears because WordPress associates the post with two parents (or I guess grandparents). So I'm trying to see if I can get around that.

    I've looked at custom post types (they are pretty neat looking), but I'm not sure I need them for this. Also they have almost zilch screen options for some reason when you make them.

    Suggestions?

    Thanks!

    Nadine

  2. nadine00
    Member
    Posted 2 years ago #

    Anyone?

Topic Closed

This topic has been closed to new replies.

About this Topic