No need for a huge fancy post, here is a very simple WordPress widget:
You must paste this code into your theme’s functions.php file located at: /wp-content/themes/YOUR_THEME
class My_Simple_Widget {
function control(){
$data = get_option('My_Simple_Widget_data');
?>
<p><label>Title:</label> <input name="My_Simple_Widget_title" type="text" value="<?php echo $data['title']; ?>" /></p>
You can have whatever you want here, even a huge form with any kind of form field you want...
<?php
if (isset($_POST['My_Simple_Widget_title'])) {
$data['title'] = attribute_escape($_POST['My_Simple_Widget_title']);
update_option('My_Simple_Widget_data', $data);
}
}
function widget($args) {
$data = get_option('My_Simple_Widget_data');
echo $args['before_widget'];
echo $args['before_title'] .$data['title'] .$args['after_title'];
echo 'Here you can have whatever you can imagine...';
echo $args['after_widget'];
}
}
wp_register_sidebar_widget('My_Simple_Widget_ID', 'My Simple Widget Title', array('My_Simple_Widget', 'widget'));
wp_register_widget_control('My_Simple_Widget_ID', 'My Simple Widget Title', array('My_Simple_Widget', 'control'));This widget will show up in your dashboard under Appearance > Widgets and you can add it to your sidebar.
I hope this helps

I'm a programmer at 
Fantastic post, simple and straight forward.
Help a lot, thanks
Comment