基于Wordpress页面模板更改导航

时间:2016-10-06 18:38:47

标签: php wordpress if-statement

我希望主页上没有徽标的导航,并在整个网站的其余部分导航徽标。这是我目前在我的header.php中为我的孩子主题。

<?php if ( is_page_template('page-templates/wex_home.php') ) : ?>
   <div class="btn-menu col-md-8 col-sm-6 col-xs-12"><i class="fa fa-navicon"></i></div>
   <nav id="mainnav" class="main-navigation col-md-8 col-sm-12 col-xs-12" role="navigation">
     <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_id' => 'primary-menu' ) ); ?>
   </nav><!-- #site-navigation -->
<?php else : ?>
   <div class="site-branding col-md-4 col-sm-6 col-xs-12">
     <?php astrid_branding(); ?>
   </div>
   <div class="btn-menu col-md-8 col-sm-6 col-xs-12"><i class="fa fa-navicon"></i></div>
   <nav id="mainnav" class="main-navigation col-md-8 col-sm-6 col-xs-12" role="navigation">
     <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_id' => 'primary-menu' ) ); ?>
   </nav><!-- #site-navigation -->
<?php endif; ?>

2 个答案:

答案 0 :(得分:0)

通过<table class="views-table cols-6"> <thead> <tr> <th class="a" scope="col"></th> <th class="a" scope="col"></th> <th class="a" scope="col">1</th> <th class="a" scope="col">2</th> <th class="a" scope="col">3</th> <th class="a" scope="col">4</th> </tr> </thead> <tbody> <tr class="odd views-row-first"> <td class="a"><span class="date-display-single">Friday 7 October 2016</span></td> <td class="a"><span class="date-display-single">Fri 7 Oct 2016</span></td> <td class="a"><img alt="Yes" class="check" src="image.png" title="Yes"></td> <td class="a"></td> <td class="a"></td> <td class="a"></td> </tr> <tr class="even"> <td class="a"><span class="date-display-single">Friday 14 October 2016</span></td> <td class="a"><span class="date-display-single">Fri 14 Oct 2016</span></td> <td class="a"></td> <td class="a"><img alt="Yes" class="check" src="image.png" title="Yes"></td> <td class="a"><img alt="Yes" class="check" src="image.png" title="Yes"></td> <td class="a"><img alt="Yes" class="check" src="image.png" title="Yes"></td> </tr> </tbody> </table> 功能检查header.php文件中主页上是否有简单的方法。可以找到更多信息here

答案 1 :(得分:0)

我会尝试使用黄色铅笔插件,它可以编辑特定页面的CSS。它有一个很好的编辑器,可以帮助您选择该页面上徽标的可见性,只需按下隐藏和不可见按钮即可。只是一种实现目标的超级简单方法。