jeudi 6 octobre 2016

Change nav based on Wordpress page template

I want to have a nav without the logo on the homepage and nav with the logo throughout the rest of the site. This is what I currently have in my header.php for my child theme.

<?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; ?>

Aucun commentaire:

Enregistrer un commentaire