Add Admin Menu Separators


/ Published in: PHP
Save to your folder(s)

Please add this code to functions.php
This will add admin menu separators between all admin menu items.


Copy this code and paste it in your HTML
  1. function wp_admin_add_separators(){
  2. ?>
  3. <script type="text/javascript">
  4. var addSeparators = function(){
  5. jQuery('#adminmenu > li').each(function(){
  6. var $this = jQuery(this);
  7. var $next = $this.next();
  8. if($next && !$this.hasClass('wp-menu-separator') && !$next.hasClass('wp-menu-separator')){
  9. $next.before('<li class="wp-not-current-submenu wp-menu-separator" aria-hidden="true"><div class="separator"></div></li>');
  10. }
  11. });
  12. };
  13.  
  14. var checkForSeparators = setInterval(function(){
  15. if(jQuery('#adminmenu').size()){
  16. addSeparators();
  17. clearInterval(checkForSeparators);
  18. }
  19. }, 20);
  20. </script>
  21. <?php
  22. }
  23.  
  24. add_action('admin_head', 'wp_admin_add_separators');

Report this snippet


Comments


You need to login to view comments.