Well designed and thought out
-
Very near perfect. (Though I’ve only so far used the Dashicons and FontAwesome options.) I assume the reason for having the various font/icon options behind checkboxes to enable them is to avoid including unnecessary CSS and fonts if they are not actually used.
I’m pleased to see that style attributes are not written out if they are the default values (thus making overriding with CSS easier without having to use the dreaded
!important
).Having default settings for each menu is a very useful feature (note that changes only apply to newly added menu items, which is what you’d expect).
In my case, I want a larger default icon size for a specific menu location, and can easily achieve this using the
menu_icons_menu_settings
filter:\add_filter( 'menu_icons_menu_settings', function($menuSettings, $menuId) { $menuLocations = \array_flip(\get_nav_menu_locations()); if (($menuLocations[$menuId] ?? null) === 'mobile_menu') { $menuSettings = \is_array($menuSettings) ? $menuSettings : []; $menuSettings += ['font_size' => '1.4']; } return $menuSettings; }, 10, 2 );
However, it would be nice if there was a filter invoked from
Menu_Icons_Front_End::get_icon_style()
so I could also easily override the defaults used for comparison when generating the front end markup for a specific menu ID. (Themenu_icons_default_style
filter applies to all menus.)(Also, I think you can use the
nav_menu_item_title
filter instead ofthe_title
to more precisely target the menu item ‘title’.)
- The topic ‘Well designed and thought out’ is closed to new replies.