I am looking for a way to add some custom classes to the admin menus using PHP.
For example, here are the li tag for Posts and Pages:
<li id="menu-posts" class="wp-has-submenu wp-has-current-submenu wp-menu-open open-if-no-js menu-top menu-icon-post menu-top-first">
<li id="menu-pages" class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-page">
In the Posts li tag I would like to add a custom class (e.g. custom_one) so that it would look like this:
<li id="menu-posts" class="custom_one wp-has-submenu wp-has-current-submenu wp-menu-open open-if-no-js menu-top menu-icon-post menu-top-first">
But for the Pages li tag I would like to add a different custom class (e.g., custom_two) so that it would look like this:
<li id="menu-pages" class="custom_two wp-has-submenu wp-not-current-submenu menu-top menu-icon-page">
Any idea how to do this vis-a-vis the functions.php file?
Thanks,
Moshe
The following does the job:
And if you want to inspect what the
$menu
contains, use this: