Created
February 3, 2012 22:49
-
-
Save viruthagiri/1733478 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class My_Walker_Nav_Menu extends Walker_Nav_Menu { | |
function start_lvl(&$output, $depth) { | |
$indent = str_repeat("\t", $depth); | |
$output .= "\n$indent<ul class=\"dropdown-menu\">\n"; | |
} | |
function start_el( &$output, $item, $depth, $args ) { | |
if ( $args->has_children ) { | |
// ... | |
} | |
} | |
} | |
add_filter('nav_menu_css_class', 'my_css_attributes_filter', 100, 1); | |
add_filter('nav_menu_item_id', 'my_css_attributes_filter', 100, 1); | |
function my_css_attributes_filter($var) { | |
if(is_array($var)){ | |
$varci= array_intersect($var, array('current-menu-item')); | |
$cmeni = array('current-menu-item'); | |
$selava = array('active'); | |
$selavaend = array(); | |
$selavaend = str_replace($cmeni, $selava, $varci); | |
} | |
else{ | |
$selavaend= ''; | |
} | |
return $selavaend; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment