-
Notifications
You must be signed in to change notification settings - Fork 573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add_submenu_page position / order not working #1380
Comments
Looks like a good potential new enhancement, thanks for pointing this out. For those maybe not familiar, the position argument looks like it was added in WordPress 5.3 |
Can I do this without changing inside CMB2 folder inside my plugin now? It works by changing inside CMB2 but in that way other plugin that also includes CMB2 can again over-ride this. |
Unsure how easy it'd be to extend this part of CMB2 to use your own version instead of the version in CMB2 itself for all the appropriate arguments etc. I do know that CMB2 has some pretty smart loading going on where the latest version will get loaded first and any other version found in the website doesn't get used. Beyond that, the only way I can think of would be just modifying or forking your own version to use for the time being, until someone decides to actively work on it and get it into the develop branch and/or release. |
Hello james0r, to change the name of the submenu itme, you must change the third parameter of the add_submenu_page() function.
|
That's only if I was directly using the Wordpress function correct? What about when creating theme options with CMB2? It seems to automatically create this first submenu item and I don't see where I have control over its naming. Maybe there's some perfect combination of arguments I'm supposed two pass in my metabox array but I havn't found it yet.
that's how I create my metabox for the parent item. Same thing occurs with this snippet from the snippet library -> https://github.com/CMB2/CMB2-Snippet-Library/blob/master/options-and-settings-pages/theme-options-cmb.php |
Does remind me and make me re-realize that this is something we'd need to get support added for to CMB2 still, as it's not at the moment. Anyone wanting to submit pull requests would be most welcome as well. |
For the solution maybe if you change this function in the CMB2_Options_Hookup.php file, the order work fine. I dont know, how can i propose the change, because i do not know enought about github. `.
` |
@alfonmaco Great stuff! Yes, changing the cap to 'unknown' did the trick for me. Almost seems more intuitive IMHO for this to be the default behavior with options-page boxes. I'm not having any issues with the position yet but if I do i'll check out your findings here. Really appreciate it. |
The priority box property is now used for the hook priority for the |
* upstream/develop: Clean up and add props for CMB2#1413 Sanitize URLs with HTTPS Add develop suffix to init class Add am-cli-tools Update changelong and version numbers and readmes, and prepare release Set default priority to 10 for options pages. Fixes CMB2#1410 build field-cache key manually to remove unnecessary |'s Better generated array key for cached fields, fixes issue where wrong field is found. Fixes CMB2#1405 Add to list of valid image types from get_allowed_mime_types(). Fixes CMB2#1223 Move tab markup output to separate method, options_page_tab_nav_output. Fixes CMB2#1407 Add cmb2_tab_group_tabs filter for adding arbitrary menu page urls to the cmb2 tabs. See CMB2#1407 Update since tag, and add props for CMB2#1340 Limit use of italic, including removing from field descriptions. Fixes CMB2#1404 Add props for CMB2#1400 move $args in deprecated_param method for 7.4 Add develop suffix to init class Prepare release and changelog for 2.8.0 Fix tests since WP_Error signature changed move $args in deprecated_param method for 7.4 Use the already-existing get_priority method. Re CMB2#1380 and CMB2#1398 Use existing "priority" field param. Fixes CMB2#1380. Closes CMB2#1398 Add admin_menu_hook_priority box property for options boxes. Fixes CMB2#1380. Closes CMB2#1398 Make field_can first param required to address php 8 "Required parameter follows optional parameter". Fixes CMB2#1396 Update includes/types/CMB2_Type_Colorpicker.php Update includes/types/CMB2_Type_Colorpicker.php Update includes/CMB2_Utils.php Prevent array to string conversion Update includes/types/CMB2_Type_Colorpicker.php Update includes/types/CMB2_Type_Colorpicker.php Update includes/types/CMB2_Type_Colorpicker.php Update includes/types/CMB2_Type_Colorpicker.php Update includes/types/CMB2_Type_Colorpicker.php Update includes/types/CMB2_Type_Colorpicker.php Added sanitize_color() function and remove PHP warnings suppresions Fixes PHP warnings on repeatable ColorPicker with an array as default
There is no option to set position or order a submenu item inside an already exist main menu item.
Currently It is possible via small adjustments:-
Hope next version will add some adjustments to order a submenu.
The text was updated successfully, but these errors were encountered: