If you want to add a custom HTML class name to admin screen submenu items? You can do a str_replace on the html which will happen before the page has loaded. Just need to work out the selectors or then parse it with DOMDocument.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | function callback($buffer) { $buffer = str_replace('wp-first-item', 'wp-first-item my-custom-class', $buffer); return $buffer; } function buffer_start() { ob_start("callback"); } function buffer_end() { ob_end_flush(); } add_action('admin_head', 'buffer_start'); add_action('admin_footer', 'buffer_end'); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.