custom menu not showing in post of categories
-
I’ve been racking my head for days and can’t seem to get this sorted.
I have a custom menu called ‘x’ it contains categories and single posts, it’s location is set to ‘single-x.php’
when I view the category archive from menu-x the menu is present, but when I view single posts from category-x (or it’s children) it is not.In my index.php I have:
} if ( in_category('x') ) { include (TEMPLATEPATH.'/single-about.php');
But no luck for single post views.
I have also tried adding:
} if ( in_category('x') || post_is_in_descendant_category( 'x' ) ) { include (TEMPLATEPATH.'/single-about.php');
Along with this in my function.php to help with the posts of descendant categories of ‘category-x’:
if ( ! function_exists( 'post_is_in_descendant_category' ) ) { function post_is_in_descendant_category( $cats, $_post = null ) { foreach ( (array) $cats as $cat ) { // get_term_children() accepts integer ID only $descendants = get_term_children( (int) $cat, 'category' ); if ( $descendants && in_category( $descendants, $_post ) ) return true; } return false; } }
Still no luck in single post view!
Any help is greatly appreciated!!!!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘custom menu not showing in post of categories’ is closed to new replies.