Я хочу изменить заголовок виджета через панель параметров в wp-admin> Внешний вид> Виджеты.
Кажется, что это не работает, после нажатия «СОХРАНИТЬ» всегда возвращается значение по умолчанию вместо сохранения.
Панель управления виджетами очень проста:
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);
}
И плагин выглядит так:
(...)
function widget_myplugin($args) {
extract($args);
echo $before_widget;
echo $before_title . $myplugin_title . $after_title;
myplugin();
echo $after_widget;
}