-
-
Save alinademi/8410f4d132be0468b62a759c756049e1 to your computer and use it in GitHub Desktop.
WordPress Widget Boilerplate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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