Hey everyone, I am finding this post in July of 2019. Just wondering if this still works or not? I have been trying to kick this off in custom theme I am writing for a client and I have tried about 8 different ways so far and am not able to make this work. I really need this reset, lol. Any thoughts on current compatability?
Goksel, your worked perfectly for me. Thanks Goksel
I see where your problem is. Take a look here and see the difference between the 2 examples i put below
Yours says this….
if( function_exists(‘acf_add_options_page’) ) {
acf_add_options_page(array(
‘page_title’ => ‘Image Settings’,
‘menu_title’ => ‘Image Settings’,
‘menu_slug’ => ‘theme-image-settings’,
‘capability’ => ‘edit_posts’,
‘icon_url’ => ‘dashicons-images-alt’,
‘position’ => 7,
‘redirect’ => true
));
acf_add_options_sub_page(array(
‘page_title’ => ‘Ads’,
‘menu_title’ => ‘Ads’,
‘parent_slug’ => ‘theme-image-settings’,
));
acf_add_options_sub_page(array(
‘page_title’ => ‘Theme Images’,
‘menu_title’ => ‘Theme Images’,
‘parent_slug’ => ‘theme-image-settings’,
));
}
so the 2 sub pages are slugged the same as rthe parent.
try it like this
if( function_exists(‘acf_add_options_page’) ) {
acf_add_options_page(array(
‘page_title’ => ‘Theme Options’,
‘menu_title’ => ‘Theme Options’,
‘menu_slug’ => ‘theme-options’,
‘compatibility’ => ‘edit_posts’,
‘parent_slug’ => ”,
‘position’ => ‘3’,
‘icon_url’ => ‘dashicons-admin-generic’,
)); **<- this gives the options panel it is THE parent
acf_add_options_sub_page(array(
‘page_title’ => ‘Image Settings’,
‘menu_title’ => ‘Image Settings’,
‘menu_slug’ => ‘theme-options-image’, < See “options” “image”
‘capability’ => ‘edit_posts’,
‘parent_slug’ => ‘theme-options’, <- See parent slug
‘position’ => ‘false’,
‘icon_url’ => ‘false’,
)); **<–this would be a child
acf_add_options_sub_page(array(
‘page_title’ => ‘Ads’,
‘menu_title’ => ‘Ads’,
‘menu_slug’ => ‘theme-options-ad’, <- See options ad
‘capability’ => ‘edit_posts’,
‘parent_slug’ => ‘theme-options’, <- See parent slug
‘position’ => ‘false’,
‘icon_url’ => ‘false’,
));
acf_add_options_sub_page(array(
‘page_title’ => ‘Theme Images’,
‘menu_title’ => ‘Theme Images’,
‘menu_slug’ => ‘theme-options-images’, <- See options images
‘compatibility’ => ‘edit_posts’,
‘parent_slug’ => ‘theme-options’, < see parent slug here
‘position’ => ‘false’,
‘icon_url’ => ‘false’,
));
}
Thanks James, worked perfectly! Dont know why I didn’t find that before
DevinWalker, was this actually pulling from the plugin field itself? I will give it a shot and see what hap[pens, thanks for your input.
Gui Tea Kim, I actually want the maps to come from the plugin, it seems that Devins code may do that for me. The reason is that I am building this site for someone else and I want everything to be as easy as possible for him. Thanks for your input as well 🙂
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.