How to add css to the wordpress primary dropdown menu

By ukmodak | March 31st 2024 10:38:39 AM | viewed 342 times

just add following code to your themes/functions.php

function your_submenu_class($menu) {
         $menu = preg_replace('/ class="sub-menu"/','/ class="sub-menu yourclass" /',$menu);  
         return $menu;  
}
add_filter('wp_nav_menu','your_submenu_class'); 

bONEandALL
Visitor

Total : 20166

Today :13

Today Visit Country :

  • China
  • United States
  • United Kingdom
  • Portugal
  • Canada