Skip to content

Instantly share code, notes, and snippets.

@islandjoe
Created October 16, 2016 21:40
Show Gist options
  • Save islandjoe/d93df53b05e1b20695902ec3ece9dfa0 to your computer and use it in GitHub Desktop.
Save islandjoe/d93df53b05e1b20695902ec3ece9dfa0 to your computer and use it in GitHub Desktop.
WordPress widget template
<? class MyWidget extends WP_Widget {
/** Widget setup **/
function MyWidget() {
parent::WP_Widget(false,
__( 'My Widget', 'mytextdomain' ),
['description' => __( 'Displays a list of stuff', 'mytextdomain' )],
['width' => '400px']
);
}
/** The back-end form **/
function form( $instance ) {
}
/** Saving form data **/
function update( $new_instance, $old_instance ) {
}
/** The front-end display **/
function widget( $args, $instance ) {
}
}
register_widget('MyWidget');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment