\n"; } /** * @param string $item Passed by reference. Used to append additional content. */ public function filter_default_pages( &$item ) { return $item; } /** * @see Walker::start_el() * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param int $current_page Menu item ID. * @param object $args */ public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; /** * If this is a default menu being called we need to fix * the item object thats coming through. */ if(!isset($item->title)){ return; } /** * Dividers, Headers or Disabled * ============================= * Determine whether the item is a Divider, Header, Disabled or regular * menu item. To prevent errors we use the strcasecmp() function to so a * comparison that is not case sensitive. The strcasecmp() function returns * a 0 if the strings are equal. */ if ( 0 == strcasecmp( $item->attr_title, 'divider' ) && 1 === $depth ) { $output .= $indent . ''; $fb_output .= ''; if ( $args['container'] ) $fb_output .= ''; echo wp_kses_post( $fb_output ); } } } /** * Add in our custom classes to the menus */ function wpml_nav_language_switcher_fix( $items , $args ) { $items = str_replace('menu-item-language-current','menu-item-language-current dropdown',$items); $items = str_replace('submenu-languages','submenu-languages dropdown-menu',$items); return $items; } add_filter( 'wp_nav_menu_items', 'wpml_nav_language_switcher_fix', 10, 2 );