Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove nav walker and Bootstrap navbar #1427

Merged
merged 1 commit into from
Apr 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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