Support » Requests and Feedback » Suggestion: alphabetic ordering of the Settings hover list

  • Hello,

    (Disclaimer, I’m witnessing it with wordpress 4.9x, my host’s not yet with php7 so WordPress 5 is still unattainable yet and I can’t tell if, who knows, it hasn’t been fixed with wordpress 5.x.)

    Currently, in the wordpress admin, when we are not in the Settings page, and we hover the mouse pointer over the Settings text in the left-side colum, that shows a list of the various pages within the Settings menu.

    However, that list isn’t ordered at all, and when we have many Settings entries, finding the one particular page we need becomes, to say the least, tedious.

    Here’s a screenshot: https://imgur.com/a/nT9hkhe

    I understand that the “default” settings entries may remain on top, they’re the most fundamental ones. I don’t agree, but I can understand the reasoning.
    But every other added entries page, linked to either a plugin or a theme, they definitely should be alphabetically sorted, for greater UI quality.

    TL;DR: I would have a simple suggestion, that this “hover list” becomes alphabetically sorted.

    Good day to whoever reads my suggestion topic!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You could suggest a change, but it is unlikely to change, because the menus are based on numbers (behind the scenes). The core menu items have one number so they are all toegether at the top and anything added after core will come after it, even if it uses the same number.
    Besides, if it were alphabetical, it would be different for every language, and things would move around depending on what plugins were installed.

    Assuming you are using a child theme (if not you’ll need to change the path for the script), you can try:

    in your functions.php

    function scripts_123qaz() {
        wp_register_script( 'sort_123qaz', get_stylesheet_directory_uri() . '/js/sort_123qaz.js', array('jquery'), '1.0.0', true);
        wp_enqueue_script( 'sort_123qaz' );
    }
    add_action( 'admin_enqueue_scripts', 'scripts_123qaz' );

    Then in your theme, if you don’t have a js folder, make one and add the file named sort_123qaz.js and the contents of that file:

    $(document).ready(function() {
    	var $sort_123qaz = this;
    	var $list_123qaz =  $('li#menu-settings ul.wp-submenu');
    	var $listLi_123qaz = $('li',$list_123qaz);
    	$listLi_123qaz.sort(function(a, b){
    		var keyA = $(a).text();
    		var keyB = $(b).text();
    		return (keyB < keyA) ? 1 : 0;
    	});
    	$.each($listLi_123qaz, function(index, row){
    		$list_123qaz.append(row);
    	});
    });

    That will sort all the list items in the Settings flyout menu, alphabetically.

    There are there ways to add this code but not knowing your theme, structure etc… this is the generic way.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.