├── README.md └── example-widget-plugin.php /README.md: -------------------------------------------------------------------------------- 1 | # Example Widget Plugin 2 | 3 | This simple WordPress plugin creates a widget which display the widget title, site title, and tagline in any widget area. This plugin was created to illustrate basic use of the `WP_Widget` class to create WordPress widgets and is discussed in an article published at the [WPMU DEV blog](https://premium.wpmudev.org/blog/?p=160800). 4 | 5 | To use the plugin go to the releases tab and download the latest release. -------------------------------------------------------------------------------- /example-widget-plugin.php: -------------------------------------------------------------------------------- 1 | 'example_widget', 'description' => 'This is an Example Widget' ); 17 | parent::__construct( 'example_widget', 'Example Widget', $widget_options ); 18 | } 19 | 20 | 21 | // Create the widget output. 22 | public function widget( $args, $instance ) { 23 | $title = apply_filters( 'widget_title', $instance[ 'title' ] ); 24 | $blog_title = get_bloginfo( 'name' ); 25 | $tagline = get_bloginfo( 'description' ); 26 | 27 | echo $args['before_widget'] . $args['before_title'] . $title . $args['after_title']; ?> 28 |

Site Name:

29 |

Tagline:

30 | 37 |

38 | 39 | 40 |

--------------------------------------------------------------------------------