Skip to content

Instantly share code, notes, and snippets.

@jandrodev
Created July 7, 2015 09:45
Show Gist options
  • Save jandrodev/5c5c5520ba34fa4ea874 to your computer and use it in GitHub Desktop.
Save jandrodev/5c5c5520ba34fa4ea874 to your computer and use it in GitHub Desktop.
Create Wordpress Widget with plugin
class Widget_Zona51 extends WP_Widget {
function Widget_Zona51() {
// Nombre, decsripción, etc. del widget
parent::WP_Widget(false, $name = 'Zona 51', $widget_options = array('description' => 'Acceso a la Zona 51'));
}
function widget($args, $instance) {
// Muestra el contenido del widget
echo 'Hola !';
echo '<input type="text" placeholder="Moreno" />';
}
function form($instance) {
// Muestra el formulario de opciones en admin
}
function update($new_instance, $old_instance) {
// procesa las opciones del widget que se guardarán
}
}
add_action('widgets_init', create_function('', 'return register_widget("Widget_Zona51");'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment