我只想指出如何插入超大下拉菜单的HTML,然后由您来设置样式和动画。
挖掘周围wp-includes/nav-menu-template.php
查找不同的有用过滤器,以修改在管理区域中创建的导航菜单。我选择了walker_nav_menu_start_el
分别应用于每个菜单项的筛选器。创建锚定标记后,可以在结束列表项之前插入更多HTML。
add_filter( \'walker_nav_menu_start_el\', \'wpse63345_walker_nav_menu_start_el\', 10, 4 );
function wpse63345_walker_nav_menu_start_el( $item_output, $item, $depth, $args ) {
// The mega dropdown only applies to the main navigation.
// Your theme location name may be different, "main" is just something I tend to use.
if ( \'main\' !== $args->theme_location )
return $item_output;
// The mega dropdown needs to be added to one specific menu item.
// I like to add a custom CSS class for that menu via the admin area.
// You could also do an item ID check.
if ( in_array( \'mega-dropdown\', $item->classes ) ) {
$item_output .= \'<div class="mega-dropdown">Your custom HTML</div>\';
}
return $item_output;
}