WP_Widget_Media_Gallery::render_media( array $instance )

In this article

Render the media on the frontend.

Parameters

$instancearrayrequired
Widget instance props.

Source

public function render_media( $instance ) {
	$instance = array_merge( wp_list_pluck( $this->get_instance_schema(), 'default' ), $instance );

	$shortcode_atts = array_merge(
		$instance,
		array(
			'link' => $instance['link_type'],
		)
	);

	// @codeCoverageIgnoreStart
	if ( $instance['orderby_random'] ) {
		$shortcode_atts['orderby'] = 'rand';
	}

	// @codeCoverageIgnoreEnd
	echo gallery_shortcode( $shortcode_atts );
}

Changelog

VersionDescription
4.9.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.