Support

Account

Home Forums Add-ons Options Page Custom option page isn't showing

Solving

Custom option page isn't showing

  • I purchased, installed and activated the plugin. Upon doing so and without any configuration, I had a new item in the admin menu “Options”. I tried adding my own code to the functions.php but it doesn’t show anything. What am I doing wrong?

    Here’s the code I added to the functions.php

    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',
    	));
    	
    }
  • Hi @nwtd

    It’s possible that you have a plugin or theme that was causing the issue. Could you please try to reproduce the issue on one of the WordPress’ stock themes (like Twenty Fifteen) with other plugins deactivated? If it disappears, then you can activate the theme and plugins one by one to see which one causes the issue.

    I’ve tested your code on my installation, and it’s working correctly. I’ve attached a screenshot for your reference.

  • 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’,
    ));

    }

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

The topic ‘Custom option page isn't showing’ is closed to new replies.