Skip to content

Instantly share code, notes, and snippets.

@masiorama
Created February 16, 2013 14:31
Show Gist options
  • Save masiorama/4967141 to your computer and use it in GitHub Desktop.
Save masiorama/4967141 to your computer and use it in GitHub Desktop.
PHP: Wordpress widget skeleton
#PHP: Wordpress widget skeleton
class My_Widget extends WP_Widget {
public function __construct() {
// widget actual processes
}
public function form( $instance ) {
// outputs the options form on admin
}
public function update( $new_instance, $old_instance ) {
// processes widget options to be saved
}
public function widget( $args, $instance ) {
// outputs the content of the widget
}
}
register_widget( 'My_Widget' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment