responsive_widget_menu_class

This function removes .menu class from custom menus in widgets only and fallback's on default widget lists and assigns new unique class called .menu-widget.

Defined (1)

The class is defined in the following location(s).

/includes/functions.php  
  1. class responsive_widget_menu_class { 
  2. public function __construct() { 
  3. add_action( 'widget_display_callback', array( $this, 'menu_different_class' ), 10, 2 ); 
  4.  
  5. public function menu_different_class( $settings, $widget ) { 
  6. if( $widget instanceof WP_Nav_Menu_Widget ) 
  7. add_filter( 'wp_nav_menu_args', array( $this, 'wp_nav_menu_args' ) ); 
  8.  
  9. return $settings; 
  10.  
  11. public function wp_nav_menu_args( $args ) { 
  12. remove_filter( 'wp_nav_menu_args', array( $this, 'wp_nav_menu_args' ) ); 
  13.  
  14. if( 'menu' == $args['menu_class'] ) 
  15. $args['menu_class'] = 'menu-widget'; 
  16.  
  17. return $args;