Home › Forums › Add-ons › Options Page › Multiple top level options pages
Hi. I read the documentation about creating multiple subpages through the functions.php, but is there a way to create multiple top level pages? If not consider this a feature request.
Hi @Brugman
It is not possible to create top level options pages at the moment.
Thanks for the feature request. I’ll keep it in mind.
Thanks
E
Hi @lupetalo
It might be worth a try, creating a custom admin page (vai native WP functions), then also creating an ACF options page and matching the ‘slug’ to that of your custom admin page.
I have a feeling that if the slugs match, the ACF options page will appear where your custom menu item is…
Thanks
E
That is a good Idea, will try and report… But it will be cool to have it implemented in Options addon… Thanks for reply…
This works very well!
add_action("admin_menu", "setup_menu");
function setup_menu() {
add_menu_page('Page Title', 'Title', 'manage_options', 'acf-acf-page-slug', 'some_function');
}
Is there a way to hide options subpage? I tried with:
add_action( 'admin_menu', 'remove_menus', 999 );
function remove_menus() {
remove_submenu_page( 'admin.php', 'acf-acf-page-slug' );
}
but no luck
Hi @lupetalo
I’ve been thinking about this a lot and will build a function in to remove the default options page, and to add parent options pages
Thanks
E
That is great news. Can you please share quick fix when you create it, i have ongoing project for client that needs to have completly clean and custom admin interface but in WP….
Here is an “in a pinch” way that I accomplished multiple menus. Hope this helps someone.
if( function_exists('acf_add_options_sub_page') ) {
acf_add_options_sub_page( __('Global') );
acf_add_options_sub_page( array( 'title' => __('Top Menu'), 'parent' => 'acf' ) );
acf_add_options_sub_page( array( 'title' => __('Main Menu'), 'parent' => 'acf-options-top-menu' ) );
acf_add_options_sub_page( array( 'title' => __('Footer Menu'), 'parent' => 'acf-options-top-menu' ) );
};
if( function_exists('acf_set_options_page_title') ){
acf_set_options_page_title( __('Theme Options') );
}
function some_function() {
// silence is golden
};
add_action('admin_menu', 'setup_menu');
function setup_menu() {
add_menu_page('Theme Menus', 'Theme Menus', 'manage_options', 'acf-options-top-menu', 'some_function');
add_submenu_page('acf-options-top-menu','','Top Menu','manage_options','acf-options-top-menu','');
}
I had a similar need and ended up using jQuery to basically grab the sub-options page element, remove it from its default location below the “Options” top level nav item, and then insert it back into the DOM in another location where I wanted it to live. Maybe not the ideal solution, but it worked fine.
I had opened up a forum topic for this and remember documenting this solution, but I can’t seem to find it here in the forum any more. Let me know if you still need assistance and I can go back in and try to document what I did.
Thanks,
Jeff
I realized that the forum has changed. Here’s a link to the original thread on the old forum:
Let me know if that helps!
Thanks,
Jeff
Thanks Elliot! Looking forward to the update.
If anyone desperately wants this right now I’m pretty sure you can do it with Admin Menu Editor Pro. The pro version lets you move menu items from sub to parent, the free doesn’t. I’m a big fan of the free version, it hides, moves and renames menu items, and might upgrade at some time.
The topic ‘Multiple top level options pages’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.