Skip to content

Commit

Permalink
Merge pull request #1427 from roots/move-walker-and-remove-bootstrap-…
Browse files Browse the repository at this point in the history
…header

Remove nav walker and Bootstrap navbar
  • Loading branch information
retlehs committed Apr 29, 2015
2 parents 9efeb67 + 64e78cf commit ca0f1c2
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 173 deletions.
1 change: 0 additions & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
'lib/config.php', // Configuration
'lib/assets.php', // Scripts and stylesheets
'lib/titles.php', // Page titles
'lib/nav.php', // Custom nav modifications
'lib/extras.php', // Custom functions
];

Expand Down
1 change: 1 addition & 0 deletions lib/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Enable theme features
*/
add_theme_support('soil-clean-up'); // Enable clean up from Soil
add_theme_support('soil-nav-walker'); // Enable cleaner nav walker from Soil
add_theme_support('soil-relative-urls'); // Enable relative URLs from Soil
add_theme_support('soil-nice-search'); // Enable nice search from Soil
add_theme_support('soil-jquery-cdn'); // Enable to load jQuery from the Google CDN
Expand Down
122 changes: 0 additions & 122 deletions lib/nav.php

This file was deleted.

35 changes: 0 additions & 35 deletions lib/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,3 @@ function get_search_form() {
return $form;
}
add_filter('get_search_form', __NAMESPACE__ . '\\get_search_form');

/**
* Make a URL relative
*/
function root_relative_url($input) {
preg_match('|https?://([^/]+)(/.*)|i', $input, $matches);
if (!isset($matches[1]) || !isset($matches[2])) {
return $input;
} elseif (($matches[1] === $_SERVER['SERVER_NAME']) || $matches[1] === $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']) {
return wp_make_link_relative($input);
} else {
return $input;
}
}

/**
* Compare URL against relative URL
*/
function url_compare($url, $rel) {
$url = trailingslashit($url);
$rel = trailingslashit($rel);
if ((strcasecmp($url, $rel) === 0) || root_relative_url($url) == $rel) {
return true;
} else {
return false;
}
}

/**
* Check if element is empty
*/
function is_element_empty($element) {
$element = trim($element);
return !empty($element);
}
19 changes: 4 additions & 15 deletions templates/header.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
<?php use Roots\Sage\Nav\NavWalker; ?>

<header class="banner navbar navbar-default navbar-static-top" role="banner">
<header class="banner" role="banner">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only"><?= __('Toggle navigation', 'sage'); ?></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="<?= esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a>
</div>

<nav class="collapse navbar-collapse" role="navigation">
<a class="brand" href="<?= esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a>
<nav role="navigation">
<?php
if (has_nav_menu('primary_navigation')) :
wp_nav_menu(['theme_location' => 'primary_navigation', 'walker' => new NavWalker(), 'menu_class' => 'nav navbar-nav']);
wp_nav_menu(['theme_location' => 'primary_navigation', 'menu_class' => 'nav']);
endif;
?>
</nav>
Expand Down

1 comment on commit ca0f1c2

@retlehs
Copy link
Member Author

@retlehs retlehs commented on ca0f1c2 May 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for anyone coming across this that wants the old functionality:

How to restore the Bootstrap nav [walkthrough] by @smutek

Please sign in to comment.