Support

Account

Home Forums Add-ons Options Page Sub-pages slug

Solved

Sub-pages slug

  • Hi everyone,
    I have one issue with sub-pages on options_page.

    I tried to add some fields via PHP file. I read the documentation so I think it’s all good but I don’t know how to set the value of location for specific sub_page. I’ve set param to “options_page”, but what else to set sub_page?

    My settings for options page is:

    if( function_exists(‘acf_add_options_page’) ) {

    // main options page
    acf_add_options_page(array(
    ‘page_title’ => ‘Web tools’,
    ‘menu_title’ => ‘Tools’,
    ‘menu_slug’ => ‘theme-settings’,
    ‘capability’ => ‘update_core’,
    ‘redirect’ => false
    ));

    // sub options page for header of the page
    acf_add_options_sub_page(array(
    ‘page_title’ => ‘Header tools’,
    ‘menu_title’ => ‘Header’,
    ‘parent’ => ‘theme-settings’
    ));
    }

    And this is my settings for location of specific field_group:

    ‘location’ => array (
    array (
    array (
    ‘param’ => ‘options_page’,
    ‘operator’ => ‘==’,
    ‘value’ => ‘theme-settings’,
    ),
    ),
    ),

    But how specify value of specific sub_page?

    Thanks for every response.

  • The first thing you want to to is alter the setting for the sub options page

    
    // sub options page for header of the page
    acf_add_options_sub_page(
      array(
        'page_title' => 'Header tools',
        'menu_title' => 'Header',
        'parent_slug' => 'theme-settings',
        'menu_slug' => 'header-tools'
      )
    );
    

    The location rule is the menu slug. Or you could go into ACF and click on add field group and then examine the select field to find out what the current value that’s being used is.

  • Hi,
    thank you a lot for advise. I tried ‘menu_slug’ but it seemed dysfunctional. After a few attempts works fine.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Sub-pages slug’ is closed to new replies.