WP_Widget::widget() WordPress Method
The WP_Widget::widget() method is used to display the widget on the front-end of the site. The method takes two arguments: an array of arguments, and an array of options. The arguments array is used to specify the widget's title, id, class, and style. The options array is used to specify the widget's width, height, and other options.
WP_Widget::widget( array $args, array $instance ) #
Echoes the widget content.
Description
Subclasses should override this function to generate their widget code.
Parameters
- $args
(array)(Required)Display arguments including 'before_title', 'after_title', 'before_widget', and 'after_widget'.
- $instance
(array)(Required)The settings for the particular instance of the widget.
Source
File: wp-includes/class-wp-widget.php
public function widget( $args, $instance ) { die( 'function WP_Widget::widget() must be overridden in a subclass.' ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.8.0 | Introduced. |