Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. /**
  2. * A widget that does amazing things!
  3. */
  4. class Amazing_Widget extends WP_Widget {
  5. /**
  6. * Registers the widget with the WordPress Widget API.
  7. *
  8. * @return void.
  9. */
  10. public static function register() {
  11. register_widget( __CLASS__ );
  12. }
  13. /**
  14. * Sets up the widget in the system.
  15. *
  16. * @return Amazing_Widget An instance of this widget.
  17. */
  18. public function __construct() {
  19. parent::__construct( 'amazing_widget', 'Amazing Widget' );
  20. }
  21. /**
  22. * Outputs the widget admin form.
  23. *
  24. * @return void.
  25. */
  26. public function form( $instance ) {
  27. // Output the widget admin form here
  28. }
  29. /**
  30. * Validates and sanitizes the widget form input.
  31. *
  32. * @return array The sanitized and updated values.
  33. */
  34. public function update( $new_instance, $old_instance ) {
  35. // Validate and sanitize updates here
  36. }
  37. /**
  38. * Outputs the widget front end markup and data.
  39. *
  40. * @return void.
  41. */
  42. public function widget( $args, $instance ) {
  43. // Output the widget front end markup here
  44. }
  45. }
  46. add_action( 'widgets_init', array( 'Amazing_Widget', 'register' ) );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement