Esqueleto de widget

<?php
/*
Plugin Name: Entrada aleatoria
Plugin URI: http://jamesbruce.me/
Description: Muestra una entrada aleatoria
Author: James Bruce
Version: 1
Author URI: http://jamesbruce.me/
*/


class EntradasWidget extends WP_Widget
{
 function EntradasWidget()
 {
 $widget_ops = array('classname' => 'EntradasWidget', 'description' => 'Muestra entrada aleatoria' );
 $this->WP_Widget('EntradasWidget', 'Entrada aleatoria con thumbnail', $widget_ops);
 }
 
 function form($instance)
 {
 $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
 $title = $instance['title'];
?>
 <p><label for="<?php echo $this->get_field_id('title'); ?>"><?=_e('Title')?>: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<?php
 }
 
 function update($new_instance, $old_instance)
 {
 $instance = $old_instance;
 $instance['title'] = $new_instance['title'];
 return $instance;
 }
 
 function widget($args, $instance)
 {
 extract($args, EXTR_SKIP);
 
 echo $before_widget;
 $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
 
 if (!empty($title))
 echo $before_title . $title . $after_title;;
 
 // WIDGET CODE GOES HERE
 echo "<h1>Ola k ase?</h1>";
 
 echo $after_widget;
 }
 
}

add_action( 'widgets_init', create_function('', 'return register_widget("EntradasWidget");') );?>