Skip to content

Instantly share code, notes, and snippets.

@ahmadawais
Created January 9, 2015 10:00
Show Gist options
  • Save ahmadawais/9a07fa142bc04ee0c8e2 to your computer and use it in GitHub Desktop.
Save ahmadawais/9a07fa142bc04ee0c8e2 to your computer and use it in GitHub Desktop.
WordPress Widget Boilerplate
<?php
/*
Plugin Name: WP Widget
Plugin URI: http://AhmadAwais.com
Description: This is a widget boilerplate.
Version: 1.0
Author: Ahmad Awais
Author URI: http://AhmadAwais.com
*/
// If this file is called directly, abort.
if(!defined('WPINC')){die;}
/**
Widget class : aa_widget_name
since 1..0
@pakage aa_wpfs
**/
class aa_widget_name extends WP_Widget {
/**
//constructor
**/
function aa_widget_name() {
parent::WP_Widget(false, $name = __('Name of Widget in admin panel', 'AA_Widget') );
}
/**
// widget form creation
**/
function form($instance) {
}
/**
// widget update
**/
function update($new_instance, $old_instance) {
/* Not needed*/
}
/**
// widget display
**/
function widget($args, $instance) {
global $aa_wopt;
?>
<section id="aa_wpfs_wrap" class="" >
<!-- Put some HTML here -->
</section>
<!-- /#aa_me -->
<?php
}
}
/**
// register widget
**/
add_action('widgets_init', create_function('', 'return register_widget("aa_widget_name");'));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment