WordPress模板-如何从导航栏中排除模板?
我创建了一个名为“页脚”的新WordPress模板。在WordPress中创建新页面时,用户选择模板“页脚页面”,新页面不应出现在导航栏中 我做了一些研究,发现了一个名为“从列表中排除页面”的东西,上面写着“使用排除参数从列表中隐藏某些页面,这些页面将由wp_List_页面生成”。但我不知道应该将其放在我的模板文件的何处?或者,这是否是从导航栏中排除模板页面的最佳方法 我的footer-page.php代码如下:WordPress模板-如何从导航栏中排除模板?,wordpress,wordpress-theming,Wordpress,Wordpress Theming,我创建了一个名为“页脚”的新WordPress模板。在WordPress中创建新页面时,用户选择模板“页脚页面”,新页面不应出现在导航栏中 我做了一些研究,发现了一个名为“从列表中排除页面”的东西,上面写着“使用排除参数从列表中隐藏某些页面,这些页面将由wp_List_页面生成”。但我不知道应该将其放在我的模板文件的何处?或者,这是否是从导航栏中排除模板页面的最佳方法 我的footer-page.php代码如下: <?php /** * Template Name: Footer pag
<?php
/**
* Template Name: Footer page
*
* A custom page template that does not appear in the navigation bar.
*
* The "Template Name:" bit above allows this to be selectable
* from a dropdown menu on the edit page screen.
*
* @package WordPress
* @subpackage Twenty_Ten
* @since Twenty Ten 1.0
*/
get_header(); ?>
<div id="container" class="one-column">
<div id="content" role="main">
<?php
/* Run the loop to output the page.
* If you want to overload this in a child theme then include a file
* called loop-page.php and that will be used instead.
*/
get_template_part( 'loop', 'page' );
?>
</div><!-- #content -->
</div><!-- #container -->
<?php get_footer(); ?>
您可以这样尝试:
if (is_page('1') || is_page('5')) {
// include template "sidebar.php".
get_template_part( 'loop', 'page' );
}
如果(是第1页('1')|是第5页('5')){
//包括模板“sidebar.php”。
获取模板部分('循环','页面');
}
您没有在仪表板的“外观->菜单”下设置菜单,有什么特殊原因吗?