WP_Widget_Media_Gallery::__construct() WordPress Method
The WP_Widget_Media_Gallery::__construct() function sets up the Media Gallery widget. It takes two parameters: an array of options, and a WP_Widget object. The options array can contain the following keys: - 'title' - The widget title. - 'description' - The widget description. - 'width' - The width of the widget in pixels. - 'height' - The height of the widget in pixels. - 'media_type' - The type of media to show in the gallery. Currently, only 'image' is supported. - 'mime_type' - The mime type of the media to show in the gallery. For example, 'image/jpeg' or 'image/gif'. - 'orderby' - The order in which to show the images. Default is 'menu_order ASC'. The WP_Widget object is used to display the widget on the front end.
WP_Widget_Media_Gallery::__construct() #
Constructor.
Source
File: wp-includes/widgets/class-wp-widget-media-gallery.php
public function __construct() {
parent::__construct(
'media_gallery',
__( 'Gallery' ),
array(
'description' => __( 'Displays an image gallery.' ),
'mime_type' => 'image',
)
);
$this->l10n = array_merge(
$this->l10n,
array(
'no_media_selected' => __( 'No images selected' ),
'add_media' => _x( 'Add Images', 'label for button in the gallery widget; should not be longer than ~13 characters long' ),
'replace_media' => '',
'edit_media' => _x( 'Edit Gallery', 'label for button in the gallery widget; should not be longer than ~13 characters long' ),
)
);
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 4.9.0 | Introduced. |