Home › Forums › Add-ons › Options Page › Change title in side bar
In my admin sidebar I want the ‘Header’ sub-page to show under the ‘TEST’ parent, but it still shows up under the default ‘Options’ menu in the side bar. And the ‘TEST’ link doesn’t have a sub-page. What am I doing wrong?
if( function_exists('acf_add_options_page') ) { acf_add_options_page('TEST'); acf_add_options_sub_page('Header'); acf_add_options_sub_page('Footer'); acf_add_options_sub_page('Accommodation'); $acf_add_options_page = (array( 'page_title' => 'TEST', 'menu_title' => 'TEST', 'menu_slug' => 'theme-options', 'capability' => 'edit_posts', 'position' => false, 'parent_slug' => '', 'icon_url' => false, 'redirect' => false )); $acf_add_options_sub_page = (array( 'page_title' => 'Header', 'menu_title' => 'Header', 'menu_slug' => 'theme-options-header', 'capability' => 'edit_posts', 'position' => false, 'parent_slug' => 'theme-options', 'icon_url' => false, 'redirect' => false, )); }
Try this:
if (function_exists('acf_add_options_page')) {
//Create the parent.
$parent = acf_add_options_page(array(
'page_title' => 'TEST',
'menu_title' => 'TEST',
'redirect' => false
));
//Create the children.
acf_add_options_sub_page(array(
'page_title' => 'Header',
'menu_title' => 'Header',
'parent_slug' => $parent['menu_slug'],
));
acf_add_options_sub_page(array(
'page_title' => 'Footer',
'menu_title' => 'Footer',
'parent_slug' => $parent['menu_slug'],
));
acf_add_options_sub_page(array(
'page_title' => 'Accommodation',
'menu_title' => 'Accommodation',
'parent_slug' => $parent['menu_slug'],
));
}
I found this on the documentation, see the bottom example “Custom options sub page”: https://www.advancedcustomfields.com/resources/acf_add_options_sub_page/
The topic ‘Change title in side bar’ 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.