Live Template: WordPress widget
Not much but thought someone could use this. I edit the variables and decapitalize the $widget$ id, decapitalize(Widget_Name).
I am new to PhpStorm so, any comments or suggestions are welcome.
* Adds $Widget_Name$ widget.
*/
class $Widget_Name$ extends WP_Widget {
/**
* Sets up the widgets name etc
*/
public function __construct() {
parent::__construct(
'$widget$', // Base ID
__('$Widget_Title', 'text_domain'), // Name
array( 'description' => __( '$Description$', 'text_domain' ), ) // Args
);
}
/**
* Outputs the content of the widget
*
* @param array $args
* @param array $instance
*/
public function widget( $args, $instance ) {
// outputs the content of the widget
}
/**
* Outputs the options form on admin
*
* @param array $instance The widget options
*/
public function form( $instance ) {
// outputs the options form on admin
}
/**
* Processing widget options on save
*
* @param array $new_instance The new options
* @param array $old_instance The previous options
*/
public function update( $new_instance, $old_instance ) {
// processes widget options to be saved
}
} // Class $Widget_Name$ widget
Please sign in to leave a comment.