dongling2038 2017-10-27 14:15
浏览 69
已采纳

使用underscores.me在WordPress中不显示菜单

I'm having trouble getting the "Menu" or "Navigation Menu" to appear in the header.

The code in header.php

<header>
 <?php if ( !is_front_page() ) : ?>
            <nav role="navigation" class="site-navigation main-navigation">
                <h1 class="assistive-text"><?php _e( 'Menu', 'underscoresme' ); ?></h1>
                <div class="assistive-text skip-link"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'underscoresme' ); ?>"><?php _e( 'Skip to content', 'underscoresme' ); ?></a></div>
                <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
            </nav><!-- .site-navigation .main-navigation -->
        <?php endif; ?>
</header>

Menu configuration in the dashboard

enter image description here

Live customization

enter image description here

It simply doesn't want to appear. There is no <nav> when inspecting in dev tools. I didn't changed anything in functions.php or any other file that contains PHP code that is used to make the theme work. I want to use Bootstrap's navigation menu.

karnopedia.com is the site.

  • 写回答

1条回答 默认 最新

  • dtbam62840 2017-10-27 15:06
    关注

    Remove the exclamation point in your !is_front_page() check. Your code works but is not displaying on front page because of the check.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!