Permalink
Browse files

Add active class to current_page_parent menu items.

  • Loading branch information...
1 parent c9db3f8 commit ac8154c725a7d21ef772bdb702598761c027822e @mindctrl committed Apr 11, 2012
Showing with 15 additions and 1 deletion.
  1. +8 −0 changelog.txt
  2. +7 −1 inc/menus.php
View
@@ -1,5 +1,13 @@
== Change log ==
+Beta Version .594 - April 10, 2012
+----------------------------------
+- Added support for sticky posts in archives.
+- Add 'active' class to current_page_parent menu items. Fixes issue of 'active' not getting assigned to parent menu item when a page is being used as the front page. Thanks to Ben Word at Roots Theme for this (and the entire walker).
+
+
+
+
Beta Version .593 - April 7, 2012
---------------------------------
- Resolved conflict with Top and Main menus being active at the same time in responsive mode. You can now use both at the same time if you wish.
View
@@ -52,7 +52,8 @@ function start_el(&$output, $item, $depth, $args) {
/* Custom Walker for Top Menu */
class alienship_Navbar_Nav_Walker extends Walker_Nav_Menu {
function check_current($val) {
- return preg_match('/(current-)|active|dropdown/', $val);
+ // return preg_match('/(current-)|active|dropdown/', $val);
+ return preg_match('/(current-)|current_page_parent|active|dropdown/', $val);
}
function start_lvl(&$output, $depth) {
@@ -69,6 +70,11 @@ function start_el(&$output, $item, $depth, $args) {
$class_names = $value = '';
$classes = empty($item->classes) ? array() : (array) $item->classes;
+
+ if (in_array('current_page_parent', $classes)) {
+ $classes[] = 'active';
+ }
+
if ($args->has_children) {
$classes[] = 'dropdown';
$li_attributes .= ' data-dropdown="dropdown"';

0 comments on commit ac8154c

Please sign in to comment.