我的插件表单代码:
function pp_settings_page() {
$pp_options = get_option('pp_options');
?>
<div class="wrap">
<h2>Post Products Settings</h2>
<form action="options.php" method="post">
<?php settings_fields('pp_options_group'); ?>
<table class="form-table">
<tr valign="top">
<th scope="row">Currency sign: </th>
<td><input type="text" name="pp_options[currency_sign]" value="<?php echo $pp_options['currency_sign']; ?>" /></td>
</tr>
</table>
<p class="submit">
<input type="submit" class="button-primary" value="Save changes" />
</p>
</form>
</div>
<?php
}我尝试使用以下命令在模板文件中调用它:
<?php $pp_options=get_option('pp_options');?>和
<?php get_option('pp_options');?>我遗漏了什么?
发布于 2011-08-16 07:11:48
您的操作需要更改为设置页面的URL,以便在发布时运行下一段代码,您可以将这些代码放入pp_settings_page函数中。
if(isset($_POST['field_name'])) {
$field_value = $_POST['field_name'];
update_option('option_name', $field_value);
}https://stackoverflow.com/questions/7068440
复制相似问题