add_sub_menu page() to be replaced by add_theme_page()

While checking my theme with theme-check plugin, i found few errors which are listed below along with the line of codes where it displays those errors(REQUIRED:) to be fixed.

REQUIRED: plugin-activation.php. Themes should use add_theme_page() for adding admin pages. Line 335: add_submenu_page(

add_submenu_page(
    $this->parent_menu_slug,                // Parent menu slug
    $this->strings['page_title'],           // Page title
    $this->strings['menu_title'],           // Menu title
    'edit_theme_options',                   // Capability
    $this->menu,                            // Menu slug
    array( &$this, 'install_plugins_page' ) // Callback
);

REQUIRED: panel_functions.php. Themes should use add_theme_page() for adding admin pages. Line 143: add_menu_page(theme_name.' Settings', theme_name ,'install_themes', 'panel' updated the list.

$icon = get_template_directory_uri().'/innovative_panel/images/ipanel-settings.png';
    add_menu_page(theme_name.' Settings', theme_name ,'install_themes', 'panel' , 'panel_options', $icon  );
    $theme_page = add_submenu_page('panel','Settings', theme_name.' Settings','install_themes', 'panel' , 'panel_options');
    add_submenu_page('panel',theme_name.' Documentation', 'Documentation','install_themes', 'docs' , 'redirect_docs');
    add_submenu_page('panel','Support', 'Support','install_themes', 'support' , 'innovative_get_support');

Also tell me whether my theme will be accepted by the reviewer with these errors?

Read More

Thanks in advance!

Related posts

1 comment

  1. Themes are required to use add_theme_page() in the WordPress Theme Directory. You need:

    add_theme_page(
        $this->strings['page_title'],           // Page title
        $this->strings['menu_title'],           // Menu title
        'edit_theme_options',                   // Capability
        $this->menu,                            // Menu slug
        array( &$this, 'install_plugins_page' ) // Callback
    );
    

    s

    add_theme_page(theme_name.' Settings', theme_name ,'install_themes', 'panel' , 'panel_options');
    $theme_page = add_theme_page('Settings', theme_name.' Settings','install_themes', 'panel' , 'panel_options');
    add_theme_page(theme_name.' Documentation', 'Documentation','install_themes', 'docs' , 'redirect_docs');
    add_theme_page('Support', 'Support','install_themes', 'support' , 'innovative_get_support');
    

Comments are closed.