我正在试图找到一种方法,在我制作的自定义管理页面中添加可重复的字段。
代码:
/*WordPress Menus API.*/
function add_new_menu_items()
{
add_menu_page(
"Theme Options",
"Theme Options",
"manage_options",
"theme-options",
"theme_options_page",
"",
100
);
}
function theme_options_page()
{
?>
<?php settings_errors(); ?>
<div class="wrap">
<div id="icon-options-general" class="icon32"></div>
<h1>Theme Options</h1>
<form method="post" action="options.php">
<?php
settings_fields("header_section");
do_settings_sections("theme-options");
submit_button();
?>
</form>
</div>
<?php
}
add_action("admin_menu", "add_new_menu_items");
function display_options()
{
add_settings_section("header_section", "Header Options", "display_header_options_content", "theme-options");
add_settings_field("header_logo", "Logo Url", "display_logo_form_element", "theme-options", "header_section");
add_settings_field("advertising_code", "Ads Code", "display_ads_form_element", "theme-options", "header_section");
register_setting("header_section", "header_logo");
register_setting("header_section", "advertising_code");
}
function display_header_options_content(){echo "The header of the theme";}
function display_logo_form_element()
{
?>
<input type="text" name="header_logo" id="header_logo" value="<?php echo get_option(\'header_logo\'); ?>" />
<?php
}
function display_ads_form_element()
{
?>
<input type="text" name="advertising_code" id="advertising_code" value="<?php echo get_option(\'advertising_code\'); ?>" />
<?php
}
add_action("admin_init", "display_options");
有没有办法使advertising\\u代码输入字段可重复?
非常感谢。