Posted on

Add submenu class

How to add submenu class for making dynamic of static menu while doing html to wordpress, we can add submenu dropdown class on wp generated submenu list

< ?php
/**
 * Add submenu class
 */
function change_submenu_class($menu) {  
  $menu = preg_replace('/ class="sub-menu"/','/ class="dropdown-menu" /',$menu);  
  return $menu;  
}  
add_filter('wp_nav_menu','change_submenu_class');
?>

Leave a Reply

Your email address will not be published. Required fields are marked *