WP_Widget::display_callback() – Generates the actual widget content (Do NOT override).
You appear to be a bot. Output may be restricted
Description
Generates the actual widget content (Do NOT override).
Finds the instance and calls WP_Widget::widget().
Usage
WP_Widget::display_callback( $args, $widget_args );
Parameters
- $args
- ( array ) required – Display arguments. See WP_Widget::widget() for information on accepted arguments.
- $widget_args
- ( int|array ) optional default: 1 – { Optional. Internal order number of the widget instance, or array of multi-widget arguments. Default 1.
- $number
- ( int ) optional default: 1 – Number increment used for multiples of the same widget. }
Returns
void
Source
File name: wordpress/wp-includes/class-wp-widget.php
Lines:
1 to 41 of 41
public function display_callback( $args, $widget_args = 1 ) { if ( is_numeric( $widget_args ) ) { $widget_args = array( 'number' => $widget_args ); } $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) ); $this->WP_Widget::_set( $widget_args['number'] ); $instances = $this->WP_Widget::get_settings(); if ( isset( $instances[ $this->number ] ) ) { $instance = $instances[ $this->number ]; /** * Filters the settings for a particular widget instance. * * Returning false will effectively short-circuit display of the widget. * * @since 2.8.0 * * @param array $instance The current widget instance's settings. * @param WP_Widget $widget The current widget instance. * @param array $args An array of default widget arguments. */ $instance = apply_filters( 'widget_display_callback', $instance, $this, $args ); if ( false === $instance ) { return; } $was_cache_addition_suspended = wp_suspend_cache_addition(); if ( $this->WP_Widget::is_preview() && ! $was_cache_addition_suspended ) { wp_suspend_cache_addition( true ); } $this->WP_Widget::widget( $args, $instance ); if ( $this->WP_Widget::is_preview() ) { wp_suspend_cache_addition( $was_cache_addition_suspended ); } } }