tirussell
Member
Posted 1 year ago #
Is there a way to "promote" the new menu interface to the top-level admin links? I would like my authors to be able to manage menus within their sites (I am using WordPress more as a CMS in this case), but not other appearance items like themes, header, etc.
I think I can do this with add_menu_page, but how do I connect this to the existing functionality?
tirussell
Member
Posted 1 year ago #
tirussell
Member
Posted 1 year ago #
last friendly bump - any help much appreciated!
tirussell
Member
Posted 1 year ago #
Figured it out:
function add_nav_menu() {
if (!current_user_can('update_core')) {
$page_title = "Manage Your Navigation Menu";
$menu_title = "Menu";
$capability = "edit_posts";
$menu_slug = "nav-menus.php";
$icon_url = plugins_url('menu.png');
add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position );
}
}
// Add capability to the editor role
// store the 'Editor' role
$edit_editor = get_role('editor');
// add a capability of 'upload_files';
$edit_editor->add_cap('edit_themes');
$edit_editor->add_cap('edit_theme_options');
tirussell
Member
Posted 1 year ago #
To be clear, the above should go in your theme's functions.php file or be part of a plugin.