User Tools

Site Tools


wordpress_add-on_gallery_shortcode

Using the [gallery] Shortcode

As of Wordpress Add-on 1.2.4, we have begun to rewrite our theme's implementation of Wordpress galleries.

To be completely clear, these galleries are not Backlight-managed. We are talking about images uploaded to, and managed by and within Wordpress.

The easiest way to create a gallery in WordPress is to use the new Media Manager. That procedure is well documented in the WordPress Codex, so I'll not repeat it.

Read about how to create an image gallery in WordPress.

Using the editor's Text view, we can then change the gallery type and properties by modifying the [gallery] shortcode.

All of the gallery types below support the following properties in the standard way: orderby, order, size, include, exclude.

Additional properties or variant behaviors may be available depending on the gallery type, detailed below.

Classic Grid

The default gallery type, displays hyperlinked thumbnails in a grid layout; thumbnails typically link either to the image file itself, or to the image's attachment page.

At it's most basic configuration, the [gallery] shortcode may be written as:

[gallery]

The shortcode also accepts a number of optional properties, allowing the user to customize galleries individually.

OPTIONS:

There is one option relevant to galleries, in AppearanceCustomize. Filed under Posts, enable the option “Use in-build Fancybox for Galleries” to display images using the Fancybox slideshow.

To use another Lightbox plugin for galleries, disable this option. The option is disabled by default.

PROPERTIES:

columns
integer

A guideline for the desired number of columns in your thumbnail grid. This is not a static value; the thumbnail grid is responsive, and will display a varying number of columns depending on the size of the browser's viewport.

If the columns property is absent in the shortcode, then columns and breakpoints will be applied as defined for the template in Backlight's designer.

If the columns property is present in the shortcode, then the maximum number of columns will be set according to the property value. At 992, 640 and 414-pixel breakpoints, columns are hard-coded into CSS and the property value will be ignored,

[gallery columns="5"]

link
file, none

  • file - thumbnails link to the image file.
  • none - thumbnails are not hyperlinked.

If the link property is unspecified, thumbnails will link to the image attachment page by default.

If using the Fancybox slideshow, enabled via theme options as described above, omit the link property, or set as “file”.

[gallery link="file"]

size
thumbnail, medium, large, full

Specifies the rendition size of image to be used as thumbnail. If unspecified, defaults to “thumbnail”.

[gallery size="medium"]

rendition
thumbnail, medium, large, full

Specifies the rendition size of image to be used in the Fancybox slideshow. If unspecified, defaults to “large”.

This is a custom property, otherwise unused by Wordpress outside of our Fancybox implementation.

[gallery size="full"]

Juxtapose

Displays image pairs using a transitional slider. Good for comparing two images, or two versions of an image. Specify the “type” and “size” properties to use.

[gallery type="juxtapose" size="large"]
wordpress_add-on_gallery_shortcode.txt · Last modified: 2017/11/28 06:19 by matthew