Support » Plugin: Admin Menu Editor » Wicked Folders – Toggle Function – err 404

  • Resolved imincognito

    (@imincognito)


    Wicked Folders 2.18.10
    Admin Menu Editor Pro 2.16.1

    Wicked Folders Toggle must be in the root menu of Admin Menu Editor – otherwise, there is an err 404 when toggling Wicked Folders.

    I’m posting this to both plugins’ support forums, but I suspect this is an Admin Menu Editor issue, because prior to 2.16.1, having the Wicked Toggle item in a sub-menu worked.

    Normally, I wouldn’t care, but I have a standard menu system for all my sites, so users have been trained to look for the toggle in a certain place and…some of my root menus are rather long.

    Any way to get this fixed? Certainly not urgent, but I think any WP plugin should work in a sub-menu…

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Janis Elsts

    (@whiteshadow)

    Short answer:
    When you move a top-level menu item to a submenu, that necessarily changes the HTML structure of the admin menu. Wicked Folders doesn’t recognize the new structure. This could potentially be fixed by changing one or two lines in Wicked Folders.

    Longer, more technical answer:
    I’ve looked at parts of Wicked Folders source code, and it appears that it uses this selector to find the “Toggle folders” menu item:

    #adminmenu #toplevel_page_wicked_folders_toggle a

    It then uses some simple JavaScript to show/hide the folder pane.

    The second part of that selector is a unique ID. WordPress core automatically generates this ID based on the item’s slug and a few other things. WordPress uses this ID as the id attribute for a top-level menu.

    However, WordPress never assigns id attributes to submenu items. As a result, the selector doesn’t work when the item is in a submenu.

    One way to work around that would be to add an alternative selector that also works in submenus. For example, Wicked Folders could use a class instead of/in addition to an ID. Technically, the documented WordPress API doesn’t support adding CSS classes to admin menus, but the actual code does support it, and Admin Menu Editor will preserve menu CSS classes when moving an item.

    For example:

    #adminmenu .toplevel_page_wicked_folders_toggle a

    Something more exotic, like using the menu slug in the selector, might also work:

    #adminmenu li > a[href="wicked_folders_toggle"]

    Thread Starter imincognito

    (@imincognito)

    Janis,

    Many thanks for the prompt and in-depth response.

    Based on your explanation, I think WF needs to tweak their plugin to support sub-menu functionality.

    In the meantime, I’ve moved this particular item to the root menu.

    Cheers

    Thanks Janis for looking into this and for the suggestions. We’ll implement a different selector so that the item works in sub menus as well.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Wicked Folders – Toggle Function – err 404’ is closed to new replies.