Skip to content

Instantly share code, notes, and snippets.

@kantoniak
Last active April 18, 2017 09:23
Show Gist options
  • Save kantoniak/45d6d432bbba6aa5d4992b74d344d660 to your computer and use it in GitHub Desktop.
Save kantoniak/45d6d432bbba6aa5d4992b74d344d660 to your computer and use it in GitHub Desktop.
<?php
class MyNewWidget extends WP_Widget {
function __construct() {
// Instantiate the parent object
parent::__construct('mynewwidgetbaseid, 'My New Widget Title');
}
function widget($args, $instance) {
// Widget output
}
function update($new_instance, $old_instance) {
// Save widget options
}
function form($instance) {
// Output admin widget options form
}
}
function myplugin_register_widgets() {
register_widget('MyNewWidget');
}
add_action('widgets_init', 'myplugin_register_widgets');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment