要替换为Add_Theme_Page()的Add_Sub_Menu页面()

时间:2013-12-27 作者:Furqan Mahmood

在使用主题检查插件检查我的主题时,我发现下面列出了一些错误,以及显示这些错误(必需:)的代码行。

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 个回复
最合适的回答,由SO网友:hornj 整理而成

主题需要使用Wordpress主题目录中的add\\u theme\\u 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
);
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\');

结束

相关推荐

有条件地定义WP_DEBUG/仅用于管理员/记录错误(是否为所有链接附加查询参数?)

我正在服务器上开发一个站点,客户端也可以访问该站点,我想做的是显示WP_DEBUG 仅限管理员使用。引用Yoast\'s article 围绕这一点:if ( isset($_GET[\'debug\']) && $_GET[\'debug\'] == \'true\') define(\'WP_DEBUG\', true); 将显示WP_DEBUG 仅适用于具有?debug=true 依附于他们,就像http://domain.com/?debug=true我在