Nav menu fallback

<?php

ter_navbar('header');

//Nav Bar - Fallback = Pass false to hide navbar when menu does not exist
function ter_navbar($location = 'primary',$fallback = true){
if(!has_nav_menu($location) && $fallback == false) return;
?>
<nav id="<?php echo $location ?>-nav" class="navigation" role="navigation">
<?php wp_nav_menu(array('theme_location' => $location)) ?>
</nav>
<?php
}
?>

0 Comments

You must be logged in to post a comment.