Skip to content

Instantly share code, notes, and snippets.

@mucsher
Created March 29, 2013 04:46
Show Gist options
  • Save mucsher/5268799 to your computer and use it in GitHub Desktop.
Save mucsher/5268799 to your computer and use it in GitHub Desktop.
Widget Wordpress Default User
<?php
/*
Plugin Name:
Plugin URI:
Description:
Version: 1.0.0
Author: Mucsher
Author URI:
Text Domain:
Domain Path: /lang
*/
class My_Widget extends WP_Widget {
public function __construct() {
parent::__construct(
'base_id',
'name',
array(
'description' => __('text descript', 'text-domain')
)
);
// widget actual processes
}
public function widget( $args, $instance ) {
// outputs the content of the widget
}
public function form( $instance ) {
// outputs the options form on admin
}
public function update( $new_instance, $old_instance ) {
// processes widget options to be saved
}
}
// register Foo_Widget widget
add_action( 'widgets_init', create_function( '', 'register_widget( "My_Widget" );' ) );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment