我正在向子菜单页面添加一个部分,但除了一个带有三个隐藏字段的空表单外,其他内容都没有输出。
<?php
function testTheme_add_admin_page() {
//add admin page
add_menu_page(\'testTheme custom options\', \'Test Theme\', \'manage_options\', \'alecaddd_testTheme\', \'testTheme_create_page\', get_template_directory_uri() . \'/images/sunset-icon.png\', 110);
//add submenu pages
add_submenu_page(\'alecaddd_testTheme\', \'General Settings\', \'General\',
\'manage_options\', \'alecaddd_testTheme\', \'testTheme_create_page\');
//activate custom settings
add_action(\'admin-init\', \'testTheme_custom_settings\');
}
add_action(\'admin_menu\', \'testTheme_add_admin_page\');
function testTheme_custom_settings() {
register_setting(\'testTheme-settings-group\', \'first_name\');
add_settings_section(\'testTheme-sidebar-options\', \'Sidebar Options\',
\'testTheme_sidebar_options\', \'alecaddd_testTheme\');
}
function testTheme_sidebar_options() {
echo "Sidebar Settings";
}
function testTheme_create_page() {
require_once get_template_directory() . \'/inc/templates/testTheme-
admin.php\';
}
function testTheme_general_settings() {
//Add submenu page
}
function testTheme_settings_page() {
}
testTheme管理员。PHP代码
<form method="post" action="">
<?php settings_fields(\'cleanblog-settings-group\'); ?>
<?php do_settings_sections(\'alecaddd_cleanblog\'); ?>
</form>