gallery_shortcode

SummerySummery

Builds the Gallery shortcode output.

Syntax

gallery_shortcode( array $attr )

DescriptionDescription

This implements the functionality of the Gallery Shortcode for displaying WordPress images on a post.

ParametersParameters

$attr

(array) (Required) Attributes of the gallery shortcode.

  • 'order'
    (string) Order of the images in the gallery. Default 'ASC'. Accepts 'ASC', 'DESC'.
  • 'orderby'
    (string) The field to use when ordering the images. Default 'menu_order ID'. Accepts any valid SQL ORDERBY statement.
  • 'id'
    (int) Post ID.
  • 'itemtag'
    (string) HTML tag to use for each image in the gallery. Default 'dl', or 'figure' when the theme registers HTML5 gallery support.
  • 'icontag'
    (string) HTML tag to use for each image's icon. Default 'dt', or 'div' when the theme registers HTML5 gallery support.
  • 'captiontag'
    (string) HTML tag to use for each image's caption. Default 'dd', or 'figcaption' when the theme registers HTML5 gallery support.
  • 'columns'
    (int) Number of columns of images to display. Default 3.
  • 'size'
    (string|array) Size of the images to display. Accepts any valid image size, or an array of width and height values in pixels (in that order). Default 'thumbnail'.
  • 'ids'
    (string) A comma-separated list of IDs of attachments to display. Default empty.
  • 'include'
    (string) A comma-separated list of IDs of attachments to include. Default empty.
  • 'exclude'
    (string) A comma-separated list of IDs of attachments to exclude. Default empty.
  • 'link'
    (string) What to link each image to. Default empty (links to the attachment page). Accepts 'file', 'none'.

ReturnReturn

(string) HTML content to display gallery.

SourceSource

File: wp-includes/media.php


			

ChangelogChangelog

Changelog
Version Description
2.5.0 Introduced.
Scroll to Top