我想创建自定义插件的标签,它显示了我的标签,但我在功能中给出了输入字段,当我检查它时,它没有显示这些字段,它显示隐藏的字段,显示在其中。 / p>
我想在第二个标签上添加一个大表格,建议我如何做到这一点。
这是我的代码:
<?php
function review_shortcode() {
?>
<div class="wrap">
<h1> Review</h1>
<?php
$active_tab = "api-setting";
if(isset($_GET["tab"]))
{
if($_GET["tab"] == "api-setting")
{
$active_tab = "api-setting";
}
else
{
$active_tab = "create-shortcode";
}
}
?>
<h2 class="nav-tab-wrapper">
<a href="?page=review&tab=api-setting" class="nav-tab <?php if($active_tab == 'api-setting'){echo 'nav-tab-active';} ?> "><?php _e('Api Settings'); ?></a>
<a href="?page=review&tab=create-shortcode" class="nav-tab <?php if($active_tab == 'create-shortcode'){echo 'nav-tab-active';} ?>"><?php _e('Shortcode Generator'); ?></a>
</h2>
<form method="post" action="options.php">
<?php
settings_fields("api_validation");
do_settings_sections("review");
submit_button();
?>
</form>
</div>
<?php
function display_options()
{
add_settings_section("api_validation", "API Settings", "display_header_options_content", "review");
if(isset($_GET["tab"]))
{
if($_GET["tab"] == "api-setting")
{
add_settings_field("api_sett", "API", "display_logo_form_element", "review", "api_validation");
register_setting("api_validation", "api_sett");
}
else
{
add_settings_field("advertising_code", "Ads Code", "display_ads_form_element", "review", "api_validation");
register_setting("api_validation", "advertising_code");
}
}
else
{
add_settings_field("api_sett", "API", "display_logo_form_element", "review", "api_validation");
register_setting("api_validation", "api_sett");
}
}
function display_header_options_content(){echo "check review working";}
function display_logo_form_element()
{
?>
<input type="text" name="api_sett" id="api_sett" value="<?php echo get_option('api_sett'); ?>" />
<?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");
}