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.

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

报告相同问题?

悬赏问题

  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了