wp-admin> Appearance> Widgetsのオプションパネルで変更可能なウィジェットのタイトルが必要です。Wordpress Widgetのオプションの保存が機能しません
"SAVE"をクリックしても機能していないようですが、保存する代わりにデフォルトが返されます。
ウィジェットコントロールパネルは非常に単純です:
function myplugin_control() {
echo '<p>
<label for="myplugin_title">Title:</label>
<input id="myplugin_title" name="myplugin_title" type="text" value="Default title:"/>
</p>
<p>
<label for="myplugin_number">Number of items to show:</label>
<input id="myplugin_number" name="myplugin_number" type="text" value="5" size="3"/>';
$myplugin_title = ($_POST["myplugin_title"]);
$myplugin_number = ($_POST["myplugin_number"]);
update_option('myplugin_widget', $myplugin_number , $myplugin_title);
}
、プラグインは次のようになります:私はあなたが(にupdate_optionを使用していると思う
(...)
function widget_myplugin($args) {
extract($args);
echo $before_widget;
echo $before_title . $myplugin_title . $after_title;
myplugin();
echo $after_widget;
}