categories - Show alternative menu based on page template AND post category

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 pag

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

相关推荐

  • categories - Show alternative menu based on page template AND post category

    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 pag

    11小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信