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.


Top ↑

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.


Top ↑

Source

File: wp-includes/class-wp-widget.php

	public function widget( $args, $instance ) {
		die( 'function WP_Widget::widget() must be overridden in a subclass.' );
	}


Top ↑

Changelog

Changelog
VersionDescription
2.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.