• Hi, I am new to WP php and working on a project to create a custom menu.

    I want to recreate the Appearance>Menu page, I copy paste the nav-menu.php to my own plugin. The save menu functions works fine but the menu editor UI (Drag & Drop) section is not displaying.

    How can i make it work so that i can do more customization on our own menu page instead of modifying WordPress original codes

    • This topic was modified 2 years, 6 months ago by wintear.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    The interactivity of the menus screen is accomplished with JavaScript or one of its variants. The nav-menu.php code doesn’t load these scripts itself, they are loaded as part of the admin init process. Check the WP page’s sources to learn what scripts are loaded. You surely wouldn’t need all of it, but it may take some doing to figure out what is and is not needed.

    What sort of customization are you envisioning? Replicating the menu UI could get rather messy. IMO you’d be better off leaving it be as-is and either extending or supplementing what’s already there.

    Thread Starter wintear

    (@wintear)

    @bcworkz I plan to modify some of the things in the menu by

    1. copy exact same menu editor page to my plugin
    2. set a custom menu page link in admin page
    3. hide “primary” menu from being show/selected, Only allow them to purely create menu only and not able to set to primary etc

    Reason for this as we want to create an multi-level approval for anyone modified or editing the menu items as we cant find any plugins that call do that.

    The closest plugin we can find is Oasis workflow plugin which currently met our requirement on multi-level approval for page content ONLY

    • This reply was modified 2 years, 6 months ago by wintear.
    Moderator bcworkz

    (@bcworkz)

    It’s going to be messy trying to replicate the native menu UI in a plugin. It’s not impossible, but it’s messy. Resolving dependencies isn’t trivial.

    I think there’d be a way to remove or hide certain menus on the native menu UI without replicating the entire thing. Then you could utilize the native menu UI for your own purposes without the need to replicate the entire thing.

    The menus screen would get its menus and menu items as either taxonomy term or posts queries. These can be altered as we would alter any term or posts query, so you could exclude certain items from query results. Menu items are simply posts of a particular type (nav_menu_item). They are tied to a specific menu through the taxonomy “nav_menu”.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom menu plugin’ is closed to new replies.