0

"screenshot"

How can I create a submenu page like this? I have taken a look at add_menu_page and add_submenu_page, but I dont get further from there.

Any help is appreciated.

  • You can use any option framework like option tree, redux framework, titan framework to easily create and customize your theme option. But If you want to create it manually than you can search and follow some tutorial like This – Porosh Ahammed Sep 11 '17 at 19:29
0

I am sure other people could point out other methods, but I'm just putting here what I consider to be the fastest method: use Advanced Custom Fields PRO and their option pages functionality. From their documentation:

if( function_exists('acf_add_options_page') ) {

acf_add_options_page(array(
    'page_title'    => 'Theme General Settings',
    'menu_title'    => 'Theme Settings',
    'menu_slug'     => 'theme-general-settings',
    'capability'    => 'edit_posts',
    'redirect'      => false
));

acf_add_options_sub_page(array(
    'page_title'    => 'Theme Header Settings',
    'menu_title'    => 'Header',
    'parent_slug'   => 'theme-general-settings',
));

acf_add_options_sub_page(array(
    'page_title'    => 'Theme Footer Settings',
    'menu_title'    => 'Footer',
    'parent_slug'   => 'theme-general-settings',
));

}

Then, when you need any of the values from the option pages, just use something like this:

$option_x = get_field('option_x', 'options');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.