Php 如何在Wordpress中创建菜单中不可见的页面
我想在wordpress中创建一些页面,但我不喜欢这些页面在菜单中可见。如何创建这样的页面Php 如何在Wordpress中创建菜单中不可见的页面,php,wordpress,Php,Wordpress,我想在wordpress中创建一些页面,但我不喜欢这些页面在菜单中可见。如何创建这样的页面 谢谢这通常取决于你的主题,我想 如果我没有错的话,一些主题在“主题选项”页面上会有一个选项。如果该选项不存在,则您使用的主题的作者没有提供该选项,因此您需要重新编码主题或切换到其他主题。我认为这通常取决于您的主题 如果我没有错的话,一些主题在“主题选项”页面上会有一个选项。如果选项不存在,则您使用的主题的作者没有提供该选项,因此,您需要重新编码主题或切换到另一个主题。使用类似或与一起工作以排除页面如果您正
谢谢这通常取决于你的主题,我想
如果我没有错的话,一些主题在“主题选项”页面上会有一个选项。如果该选项不存在,则您使用的主题的作者没有提供该选项,因此您需要重新编码主题或切换到其他主题。我认为这通常取决于您的主题
如果我没有错的话,一些主题在“主题选项”页面上会有一个选项。如果选项不存在,则您使用的主题的作者没有提供该选项,因此,您需要重新编码主题或切换到另一个主题。使用类似或与一起工作以排除页面如果您正在使用/创建自定义主题或不介意扩展正在使用的主题,请使用类似或与一起工作以排除页面,您可以通过编辑链接明确指定要在菜单中显示的页面名称或ID。在我的自定义主题中,我只是进入并销毁了动态生成的链接,用我自己的链接替换它们 我选择在自己的一个项目中这样做,因为我希望能够有很多非导航页面,而不必不断添加以排除页面 编辑(更具体地说): 默认主题(wp content/themes/twentyten)中的导航位于header.php文件中,如下所示:
<div id="access" role="navigation">
<?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff */ ?>
<div class="skip-link screen-reader-text"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyten' ); ?>"><?php _e( 'Skip to content', 'twentyten' ); ?></a></div>
<?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?>
<?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
</div><!-- #access -->
如果正在使用/创建自定义主题或不介意扩展正在使用的主题,则可以通过编辑链接明确指定要在菜单中显示的页面名称或ID。在我的自定义主题中,我只是进入并销毁了动态生成的链接,用我自己的链接替换它们
我选择在自己的一个项目中这样做,因为我希望能够有很多非导航页面,而不必不断添加以排除页面
编辑(更具体地说):
默认主题(wp content/themes/twentyten)中的导航位于header.php文件中,如下所示:
<div id="access" role="navigation">
<?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff */ ?>
<div class="skip-link screen-reader-text"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyten' ); ?>"><?php _e( 'Skip to content', 'twentyten' ); ?></a></div>
<?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?>
<?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
</div><!-- #access -->
你能告诉我如何销毁动态生成的链接,用我自己的链接替换它们吗?你能告诉我如何销毁动态生成的链接,用我自己的链接替换它们吗?
<div id="access" role="navigation">
<?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff */ ?>
<div class="skip-link screen-reader-text"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyten' ); ?>"><?php _e( 'Skip to content', 'twentyten' ); ?></a></div>
<?php /* Our CUSTOM navigation menu. */ ?>
<div class="menu">
<ul>
<li class="<?php if (!is_paged() && is_home()) { ?>current_page_item<?php } else { ?>page_item<?php } ?>"><a href="<?php bloginfo('url'); ?>" title="Home">Home</a></li>
<li class="<?php if (is_page('cool-stuff')) { ?>current_page_item<?php } else { ?>page_item<?php } ?>"><a href="<?php bloginfo('url'); ?>/cool-stuff" title="Cool Stuff">Cool Stuff</a></li>
<li class="<?php if (is_page('about-us')) { ?>current_page_item<?php } else { ?>page_item<?php } ?>"><a href="<?php bloginfo('url'); ?>/about-us" title="About Us">About Us</a></li>
</ul>
</div>
</div><!-- #access -->