Gallery
in package
Display an album gallery as a grid of images.
The grid uses CSS columns. This will handle different aspect ration images. This provides a visually acceptable way to mix portrait and landscape images.
Tags
Table of Contents
Constants
- CARD_DEFAULTS = array('image_id' => 0, 'itemprop' => 'AssociatedMedia', 'itemtype' => 'https://schema.org/ImageObject', 'metadata' => array(), 'url' => '')
- Gallery item default attributes.
- CONTAINER_DEFAULTS = array('album' => '', 'itemprop' => '', 'itemtype' => 'https://schema.org/ImageGallery', 'metadata' => array())
- Gallery container default attributes.
- GALLERY_CONTAINER = 'gallery-container.php'
- Gallery container filename.
- GALLERY_ITEM = 'gallery-item.php'
- Gallery item filename.
- IMAGE_SIZE = 'medium_large'
- Gallery image size.
Properties
- $album : Album
- The instance of the Album class.
- $gallery_container : string
- The fully qualified path to gallery container partial.
- $gallery_item_container : string
- The fully qualified path to gallery item partial.
- $instances : array<string|int, object>
- The array of instances of this class and sub-classes.
- $lightbox : Lightbox
- The instance of the Lightbox class.
Methods
- get_instance() : object
- Creates and/or returns the instance of this class.
- render() : void
- Render gallery image grid by album.
- __construct() : void
- Initialise the class and set its properties.
- get_cards() : string
- Return image cards.
Constants
CARD_DEFAULTS
Gallery item default attributes.
protected
array<string|int, mixed>
CARD_DEFAULTS
= array('image_id' => 0, 'itemprop' => 'AssociatedMedia', 'itemtype' => 'https://schema.org/ImageObject', 'metadata' => array(), 'url' => '')
The default gallery item display default settings. @type int $image_id The attachment ID of the image. @type string $itemprop Schema.org itemprop value for the gallery item. @type string $itemtype URL of schema.org itemtype definition. @type string[] $metadata Array of itemprop key/value pairs for the gallery item. @type string $itemprop Schema.org itemprop key. @type string $content Schema.org itemprop value. @type string $url The URL for the full size, originally uploaded image.
Tags
CONTAINER_DEFAULTS
Gallery container default attributes.
protected
array<string|int, mixed>
CONTAINER_DEFAULTS
= array('album' => '', 'itemprop' => '', 'itemtype' => 'https://schema.org/ImageGallery', 'metadata' => array())
The default gallery display default settings. @type string $album The album taxonomy slug. @type string $itemtype URL of schema.org itemtype definition. @type string $itemprop Schema.org itemprop value for the gallery container. @type string[] $metadata Array of itemprop key/value pairs for the container. @type string $itemprop Schema.org itemprop key. @type string $content Schema.org itemprop value.
Tags
GALLERY_CONTAINER
Gallery container filename.
protected
string
GALLERY_CONTAINER
= 'gallery-container.php'
Tags
GALLERY_ITEM
Gallery item filename.
protected
string
GALLERY_ITEM
= 'gallery-item.php'
Tags
IMAGE_SIZE
Gallery image size.
protected
string
IMAGE_SIZE
= 'medium_large'
Tags
Properties
$album
The instance of the Album class.
protected
Album
$album
Tags
$gallery_container
The fully qualified path to gallery container partial.
protected
string
$gallery_container
Tags
$gallery_item_container
The fully qualified path to gallery item partial.
protected
string
$gallery_item_container
Tags
$instances
The array of instances of this class and sub-classes.
protected
static array<string|int, object>
$instances
= array()
Tags
$lightbox
The instance of the Lightbox class.
protected
Lightbox
$lightbox
Tags
Methods
get_instance()
Creates and/or returns the instance of this class.
public
static get_instance() : object
Tags
Return values
object —The instance of this class.
render()
Render gallery image grid by album.
public
render([array<string|int, mixed> $args = array() ]) : void
Parameters
- $args : array<string|int, mixed> = array()
-
An array of arguments for the gallery.
Tags
__construct()
Initialise the class and set its properties.
protected
__construct() : void
Tags
get_cards()
Return image cards.
protected
get_cards([array<string|int, mixed> $args = array() ]) : string
Parameters
- $args : array<string|int, mixed> = array()
-
The display attributes.
Tags
Return values
string —The image cards markup, or empty string if a problem.