Created
July 7, 2015 09:45
-
-
Save jandrodev/5c5c5520ba34fa4ea874 to your computer and use it in GitHub Desktop.
Create Wordpress Widget with plugin
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
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