diff --git a/header.php b/header.php index 3bd62aa..de3b536 100644 --- a/header.php +++ b/header.php @@ -44,12 +44,21 @@
+ + + + +
diff --git a/inc/roots-cleanup.php b/inc/roots-cleanup.php index 14722db..cbb968b 100644 --- a/inc/roots-cleanup.php +++ b/inc/roots-cleanup.php @@ -347,4 +347,44 @@ function roots_nav_menu_args($args = '') { add_filter('wp_nav_menu_args', 'roots_nav_menu_args'); +class roots_nav_walker extends Walker_Nav_Menu { + function start_el(&$output, $item, $depth, $args) { + global $wp_query; + $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; + + $slug = sanitize_title($item->title); + + $class_names = $value = ''; + $classes = empty( $item->classes ) ? array() : (array) $item->classes; + + $classes = array_filter($classes, 'check_current'); + + $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ); + $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; + + $id = apply_filters( 'nav_menu_item_id', 'menu-' . $slug, $item, $args ); + $id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : ''; + + $output .= $indent . ''; + + $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : ''; + $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : ''; + $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : ''; + $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : ''; + + $item_output = $args->before; + $item_output .= ''; + $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; + $item_output .= ''; + $item_output .= $args->after; + + $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); + } +} + +function check_current($val) { + return preg_match('/current-menu/', $val); +} + + ?> diff --git a/inc/roots-htaccess.php b/inc/roots-htaccess.php index 4de25ee..0dd8f9f 100644 --- a/inc/roots-htaccess.php +++ b/inc/roots-htaccess.php @@ -277,4 +277,4 @@ function roots_add_htaccess($rules) { } add_action('mod_rewrite_rules', 'roots_add_htaccess'); -?> \ No newline at end of file +?> diff --git a/inc/roots-options.php b/inc/roots-options.php index 8a8396d..ff327c9 100644 --- a/inc/roots-options.php +++ b/inc/roots-options.php @@ -1,7 +1,7 @@ 'span-24', 'main_class' => 'span-14 append-1', 'sidebar_class' => 'span-8 prepend-1 last', - 'google_analytics_id' => '' + 'google_analytics_id' => '', + 'clean_menu' => true ); return apply_filters('roots_default_theme_options', $default_theme_options); @@ -156,6 +157,29 @@ function theme_options_render_page() { + + + +
+
+ +
+
+ +
+
+ + @@ -191,7 +215,10 @@ function roots_theme_options_validate($input) { if (isset($input['google_analytics_id'])) $output['google_analytics_id'] = $input['google_analytics_id']; + if (isset($input['clean_menu'])) + $output['clean_menu'] = ($input['clean_menu'] === 'yes') ? true : false; + return apply_filters('roots_theme_options_validate', $output, $input, $defaults); } -?> \ No newline at end of file +?>