I'm trying to display a menu based on the page template AND the post category is used. I got it to work for the page template like this:
if (is_page_template('page-template-heroes.php')){
$primaryNav = wp_nav_menu( array( 'menu' => 'heroes', 'theme_location' => 'primary-menu', 'container' => '', 'fallback_cb' => '', 'menu_class' => $menuClass, 'menu_id' => 'top-menu', 'echo' => false ) );
But when I try it for a page template AND category, it's not working. Must be doing something wrong.
if (is_page_template('page-template-heroes.php') && in_category( 'skills-heroes' ) ){
$primaryNav = wp_nav_menu( array( 'menu' => 'heroes', 'theme_location' => 'primary-menu', 'container' => '', 'fallback_cb' => '', 'menu_class' => $menuClass, 'menu_id' => 'top-menu', 'echo' => false ) );
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745333006a4622970.html
评论列表(0条)