use roots nav walker by default if option is set
This commit is contained in:
15
header.php
15
header.php
@@ -39,25 +39,12 @@
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<nav id="nav-main" role="navigation">
|
<nav id="nav-main" role="navigation">
|
||||||
<?php if ($roots_options['clean_menu']) { ?>
|
|
||||||
<?php wp_nav_menu(array('theme_location' => 'primary_navigation', 'walker' => new roots_nav_walker())); ?>
|
|
||||||
<?php } else { ?>
|
|
||||||
<?php wp_nav_menu(array('theme_location' => 'primary_navigation')); ?>
|
<?php wp_nav_menu(array('theme_location' => 'primary_navigation')); ?>
|
||||||
<?php } ?>
|
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<?php
|
<?php if (wp_get_nav_menu_items('Utility Navigation')) { ?>
|
||||||
$utility_nav = wp_get_nav_menu_object('Utility Navigation');
|
|
||||||
$utility_nav_term_id = (int) $utility_nav->term_id;
|
|
||||||
$menu_items = wp_get_nav_menu_items($utility_nav_term_id);
|
|
||||||
if ($menu_items || !empty($menu_items)) {
|
|
||||||
?>
|
|
||||||
<nav id="nav-utility">
|
<nav id="nav-utility">
|
||||||
<?php if ($roots_options['clean_menu']) { ?>
|
|
||||||
<?php wp_nav_menu(array('theme_location' => 'utility_navigation', 'walker' => new roots_nav_walker())); ?>
|
|
||||||
<?php } else { ?>
|
|
||||||
<?php wp_nav_menu(array('theme_location' => 'utility_navigation')); ?>
|
<?php wp_nav_menu(array('theme_location' => 'utility_navigation')); ?>
|
||||||
<?php } ?>
|
|
||||||
</nav>
|
</nav>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
$roots_options = roots_get_theme_options();
|
||||||
|
|
||||||
// redirect /?s to /search/
|
// redirect /?s to /search/
|
||||||
// http://txfx.net/wordpress-plugins/nice-search/
|
// http://txfx.net/wordpress-plugins/nice-search/
|
||||||
function roots_nice_search_redirect() {
|
function roots_nice_search_redirect() {
|
||||||
@@ -65,7 +67,6 @@ function roots_fix_duplicate_subfolder_urls($input) {
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
$roots_options = roots_get_theme_options();
|
|
||||||
if (!is_admin() && !in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php')) && $roots_options['root_relative_urls']) {
|
if (!is_admin() && !in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php')) && $roots_options['root_relative_urls']) {
|
||||||
add_filter('bloginfo_url', 'roots_root_relative_url');
|
add_filter('bloginfo_url', 'roots_root_relative_url');
|
||||||
add_filter('theme_root_uri', 'roots_root_relative_url');
|
add_filter('theme_root_uri', 'roots_root_relative_url');
|
||||||
@@ -91,7 +92,7 @@ if (!is_admin() && !in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-regi
|
|||||||
|
|
||||||
// remove root relative URLs on any attachments in the feed
|
// remove root relative URLs on any attachments in the feed
|
||||||
function roots_root_relative_attachment_urls() {
|
function roots_root_relative_attachment_urls() {
|
||||||
$roots_options = roots_get_theme_options();
|
global $roots_options;
|
||||||
if (!is_feed() && $roots_options['root_relative_urls']) {
|
if (!is_feed() && $roots_options['root_relative_urls']) {
|
||||||
add_filter('wp_get_attachment_url', 'roots_root_relative_url');
|
add_filter('wp_get_attachment_url', 'roots_root_relative_url');
|
||||||
add_filter('wp_get_attachment_link', 'roots_root_relative_url');
|
add_filter('wp_get_attachment_link', 'roots_root_relative_url');
|
||||||
@@ -332,7 +333,11 @@ function roots_nav_menu_args($args = '') {
|
|||||||
|
|
||||||
add_filter('wp_nav_menu_args', 'roots_nav_menu_args');
|
add_filter('wp_nav_menu_args', 'roots_nav_menu_args');
|
||||||
|
|
||||||
class roots_nav_walker extends Walker_Nav_Menu {
|
function roots_check_current($val) {
|
||||||
|
return preg_match('/current-menu/', $val);
|
||||||
|
}
|
||||||
|
|
||||||
|
class Roots_Nav_Walker extends Walker_Nav_Menu {
|
||||||
function start_el(&$output, $item, $depth, $args) {
|
function start_el(&$output, $item, $depth, $args) {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
$indent = ($depth) ? str_repeat("\t", $depth) : '';
|
$indent = ($depth) ? str_repeat("\t", $depth) : '';
|
||||||
@@ -367,9 +372,15 @@ class roots_nav_walker extends Walker_Nav_Menu {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function roots_check_current($val) {
|
// use the clean nav menu walker for all nav menus if the option is set
|
||||||
return preg_match('/current-menu/', $val);
|
function roots_default_wp_nav_menu_walker($args = '') {
|
||||||
|
global $roots_options;
|
||||||
|
if ($roots_options['clean_menu']) {
|
||||||
|
$args['walker'] = new Roots_Nav_Walker();
|
||||||
}
|
}
|
||||||
|
return $args;
|
||||||
|
}
|
||||||
|
add_filter('wp_nav_menu_args', 'roots_default_wp_nav_menu_walker');
|
||||||
|
|
||||||
// add to robots.txt
|
// add to robots.txt
|
||||||
// http://codex.wordpress.org/Search_Engine_Optimization_for_WordPress#Robots.txt_Optimization
|
// http://codex.wordpress.org/Search_Engine_Optimization_for_WordPress#Robots.txt_Optimization
|
||||||
|
|||||||
Reference in New Issue
Block a user