web-dev-qa-db-ja.com

add_sub_menu page()はadd_theme_page()に置き換えられます

Theme-checkプラグインで私のテーマをチェックしている間、私はそれが修正されるそれらのエラーを表示するコードの行と共に以下にリストされるいくつかのエラーを見つけました(必須:)。

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');

また、私のテーマがこれらのエラーとともにレビューアに受け入れられるかどうかを教えてください。

前もって感謝します!

1
Furqan Mahmood

テーマはWordpressテーマディレクトリのadd_theme_page()を使うために必要です。あなたが必要です:

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
);

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');
1
hornj