Products
GG网络技术分享 2025-03-18 16:12 4
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
Live customization
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.
图片转代码服务由CSDN问答提供
感谢您的意见,我们尽快改进~
功能建议我无法将“菜单”或“导航菜单”显示在标题中。</ p >
header.php </ code> </ p>
&lt; header&gt; &lt;?php if(!is_front_page( )):?&gt;
&lt; nav role =“navigation”class =“site-navigation main-navigation”&gt;
&lt; h1 class =“assistive-text”&gt;&lt;?php _e(\'Menu \',\'underscoresme\'); ?&gt;&lt; / h1&gt;
&lt; div class =“assistive-text skip-link”&gt;&lt; a href =“#content”title =“&lt;?php esc_attr_e(\'Skip to content\',\' underscoresme\');?&gt;“&gt;&lt;?php _e(\'Skip to content\',\'underscoresme\'); ?&gt;&lt; / a&gt;&lt; / div&gt;
&lt;?php wp_nav_menu(array(\'theme_location\'=&gt;\'primary\')); ?&gt;
&lt; / nav&gt;&lt;! - .site-navigation .main-navigation - &gt;
&lt;?php endif; ?&gt;
&lt; / header&gt;
</ code> </ pre>
仪表板中的菜单配置</ p>
实时自定义</ p>
它根本不想出现。 在dev工具中检查时,没有&lt; nav&gt; </ code>。 我没有在 functions.php </ code>或任何其他包含用于使主题工作的 PHP </ code>代码的文件中进行任何更改。 我想使用Bootstrap的导航菜单。</ p>
karnopedia.com 是该网站。 </ p>
</ div>
网友观点:
Remove the exclamation point in your !is_front_page() check. Your code works but is not displaying on front page because of the check.
Demand feedback