Created
July 7, 2015 08:19
-
-
Save jandrodev/0d4cddf243e13b91550f to your computer and use it in GitHub Desktop.
Wordpress Widget Base Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Widget Base Code | |
class My_Widget extends WP_Widget { | |
function My_Widget() { | |
// Nombre, decsripción, etc. del widget | |
parent::WP_Widget(false, $name = 'Nombre', $widget_options = array('description' => 'Descripción')); | |
} | |
function widget($args, $instance) { | |
// Muestra el contenido del widget | |
echo 'Hola !'; | |
} | |
function form($instance) { | |
// Muestra el formulario de opciones en admin | |
} | |
function update($new_instance, $old_instance) { | |
// Procesa las opciones del widget | |
} | |
} | |
register_widget('My_Widget'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment