我有一个菜单,我只想使用以下代码在某些页面上显示:
<?php if ( is_front_page() || is_archive() || is_404() ) {
}
else
{
if ( function_exists(\'has_parent\') ) {
$id = get_the_ID();
$menu_to_use = get_post_meta($id, \'themestore-meta-menu-name\', 1);
echo \'<nav class="nav-container group" id="nav-subheader">\';
echo \'<div class="nav-toggle" id="nav-subheader-toggle"><i class="icon-reorder"></i></div>\';
wp_nav_menu( array(\'menu\' => $menu_to_use, \'menu_class\' => \'nav container group\', \'container\' => \'\' ));
echo \'</nav>\';
}
}
?>
我有一个自定义的分类法和帖子类型,我不想在单个帖子页面上显示菜单。我尝试了以下方法,但似乎没有任何效果:if ( is_front_page() || is_archive() || is_404() || is_singular(\'tips\') )
if ( is_front_page() || is_archive() || is_404() || is_tax(\'tips\') )
if ( is_front_page() || is_archive() || is_404() || taxonomy_exists(\'tips\') )
if ( is_front_page() || is_archive() || is_404() || \'tips\' == get_post_type() )
if ( is_front_page() || is_archive() || is_404() || is_category(\'tips\') )
我已经尝试了这个答案中的两个自定义函数:If is custom post type看起来其中一个应该可以工作,但没有一个可以隐藏菜单。我错过了什么?