web-dev-qa-db-fra.com

add_sub_menu page () à remplacer par add_theme_page ()

Lors de la vérification de mon thème avec le plugin theme-check, j’ai trouvé quelques erreurs énumérées ci-dessous, ainsi que la ligne de codes sur laquelle sont affichées ces erreurs (OBLIGATOIRE :) à corriger.

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

Dites-moi également si le lecteur accepte ces thèmes avec mon thème.

Merci d'avance!

1
Furqan Mahmood

Les thèmes sont nécessaires pour utiliser add_theme_page () dans le répertoire de thèmes Wordpress. Vous avez besoin:

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