Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * A widget that does amazing things!
- */
- class Amazing_Widget extends WP_Widget {
- /**
- * Registers the widget with the WordPress Widget API.
- *
- * @return void.
- */
- public static function register() {
- register_widget( __CLASS__ );
- }
- /**
- * Sets up the widget in the system.
- *
- * @return Amazing_Widget An instance of this widget.
- */
- public function __construct() {
- parent::__construct( 'amazing_widget', 'Amazing Widget' );
- }
- /**
- * Outputs the widget admin form.
- *
- * @return void.
- */
- public function form( $instance ) {
- // Output the widget admin form here
- }
- /**
- * Validates and sanitizes the widget form input.
- *
- * @return array The sanitized and updated values.
- */
- public function update( $new_instance, $old_instance ) {
- // Validate and sanitize updates here
- }
- /**
- * Outputs the widget front end markup and data.
- *
- * @return void.
- */
- public function widget( $args, $instance ) {
- // Output the widget front end markup here
- }
- }
- add_action( 'widgets_init', array( 'Amazing_Widget', 'register' ) );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement