Add ability to include header without top navbar
This commit is contained in:
@@ -13,7 +13,7 @@ body { }
|
||||
#banner { }
|
||||
|
||||
/* Fixed Topbar Navigation */
|
||||
body { padding-top: 60px; }
|
||||
body.top-navbar { padding-top: 60px; }
|
||||
body.admin-bar .navbar-fixed-top { top: 28px; }
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ ol.commentlist img.avatar { float: left; margin-right: 10px; }
|
||||
|
||||
@media (max-width: 979px) {
|
||||
/* Fix top padding when using the responsive grid with the fixed topbar */
|
||||
body {
|
||||
body.top-navbar {
|
||||
padding-top: 0;
|
||||
}
|
||||
}
|
||||
25
header.php
25
header.php
@@ -25,24 +25,13 @@
|
||||
<!--[if lt IE 7]><p class="chromeframe">Your browser is <em>ancient!</em> <a href="http://browsehappy.com/">Upgrade to a different browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to experience this site.</p><![endif]-->
|
||||
|
||||
<?php roots_header_before(); ?>
|
||||
<header id="banner" class="navbar navbar-fixed-top" role="banner">
|
||||
<?php roots_header_inside(); ?>
|
||||
<div class="navbar-inner">
|
||||
<div class="<?php echo WRAP_CLASSES; ?>">
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</a>
|
||||
<a class="brand" href="<?php echo home_url(); ?>/">
|
||||
<?php bloginfo('name'); ?>
|
||||
</a>
|
||||
<nav id="nav-main" class="nav-collapse" role="navigation">
|
||||
<?php wp_nav_menu(array('theme_location' => 'primary_navigation', 'walker' => new Roots_Navbar_Nav_Walker(), 'menu_class' => 'nav')); ?>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<?php
|
||||
if (current_theme_supports('bootstrap-top-navbar')) {
|
||||
get_template_part('templates/header', 'top-navbar');
|
||||
} else {
|
||||
get_template_part('templates/header', 'default');
|
||||
}
|
||||
?>
|
||||
<?php roots_header_after(); ?>
|
||||
|
||||
<?php roots_wrap_before(); ?>
|
||||
|
||||
@@ -611,6 +611,14 @@ function roots_clean_style_tag($input) {
|
||||
return '<link rel="stylesheet" href="' . $matches[2][0] . '"' . $media . '>' . "\n";
|
||||
}
|
||||
|
||||
function roots_body_class_filter($classes) {
|
||||
if (current_theme_supports('bootstrap-top-navbar')) {
|
||||
$classes[] = 'top-navbar';
|
||||
}
|
||||
return $classes;
|
||||
}
|
||||
add_filter('body_class', 'roots_body_class_filter');
|
||||
|
||||
function roots_body_class() {
|
||||
$term = get_queried_object();
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ add_theme_support('root-relative-urls');
|
||||
add_theme_support('rewrite-urls');
|
||||
add_theme_support('h5bp-htaccess');
|
||||
add_theme_support('bootstrap-responsive');
|
||||
add_theme_support('bootstrap-top-navbar');
|
||||
|
||||
// Set the content width based on the theme's design and stylesheet
|
||||
if (!isset($content_width)) { $content_width = 940; }
|
||||
|
||||
11
templates/header-default.php
Normal file
11
templates/header-default.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<header id="banner" role="banner">
|
||||
<?php roots_header_inside(); ?>
|
||||
<div class="<?php echo WRAP_CLASSES; ?>">
|
||||
<a class="brand" href="<?php echo home_url(); ?>/">
|
||||
<?php bloginfo('name'); ?>
|
||||
</a>
|
||||
<nav id="nav-main" role="navigation">
|
||||
<?php wp_nav_menu(array('theme_location' => 'primary_navigation')); ?>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
18
templates/header-top-navbar.php
Normal file
18
templates/header-top-navbar.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<header id="banner" class="navbar navbar-fixed-top" role="banner">
|
||||
<?php roots_header_inside(); ?>
|
||||
<div class="navbar-inner">
|
||||
<div class="<?php echo WRAP_CLASSES; ?>">
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</a>
|
||||
<a class="brand" href="<?php echo home_url(); ?>/">
|
||||
<?php bloginfo('name'); ?>
|
||||
</a>
|
||||
<nav id="nav-main" class="nav-collapse" role="navigation">
|
||||
<?php wp_nav_menu(array('theme_location' => 'primary_navigation', 'walker' => new Roots_Navbar_Nav_Walker(), 'menu_class' => 'nav')); ?>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
Reference in New Issue
Block a user