Posted By

cusmin on 11/01/17


Tagged

plugin cusmin


Versions (?)

Add Admin Menu Separators


 / Published in: PHP
 

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

  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  

You need to login to post a comment.