Shortcode Attributes

FooGallery Documentation

Shortcode Attributes

The FooGallery shortcode is pretty powerful. There are a few attributes you can add to the shortcode to tweak it slightly from page to page and still use the same gallery.

Limit Thumbnails

You only want to show a maximum number of thumbs. Code example to limit the gallery to only show 3 thumbs:

[[foogallery id="123" limit="3"]]Code language: JSON / JSON with Comments (json)

Offset Thumbnails

You only want to start showing thumbs from a particular index. Code example to only show from the 4th thumb onwards:

[[foogallery id="123" offset="3"]]Code language: JSON / JSON with Comments (json)

Thumbnail Sort Order

Change the sort order of the gallery using the “sort” attribute. Possible values you can sort by are: 

date_desc – order thumbnails by the date they were uploaded to the media library, newest first 
date_asc – order thumbnails by the date they were uploaded to the media library, oldest first 
rand – random order
title_desc – order thumbnails inverse alphabetically by the media title 
title_asc – order thumbnails alphabetically by the media title 
modified_asc – order thumbnails by the date they were last modified, most recently modified first
modified_desc – order thumbnails by the date they were last modified, most recently modified last

[[foogallery id="123" sort="data_desc" ]]Code language: JSON / JSON with Comments (json)

Override Thumbnails

You can override which attachments are shown in a FooGallery completely by providing an attachment_ids attribute:

[[foogallery id="123" attachment_ids="45,46,49"]]Code language: JSON / JSON with Comments (json)

The ids 45,46,49 used above are the attachment id’s.

Override Gallery Template

You can override the gallery template:

[[foogallery id="123" template="masonry"]]Code language: JSON / JSON with Comments (json)

A list of gallery templates are:

  • default
  • image-viewer
  • justified
  • masonry
  • simple_portfolio
  • thumbnail
  • foogridpro
  • polaroid_new
  • slider

Dynamic Galleries

If you want, you do not even need to save a gallery to display one. Simply use the shortcode and provide a gallery template and which attachments must be used:

[[foogallery attachment_ids="45,46,49" template="masonry"]]Code language: JSON / JSON with Comments (json)

Media Tags

You can make a gallery display images that have a particular tag(s) or category(s) using shortcode attributes. For example, to make the gallery display images containing a media tag called “adventure”, you can add the shortcode attribute “media_tags” to the shortcode:

[[foogallery id="1431" media_tags="adventure"]]Code language: JSON / JSON with Comments (json)

If it was a media category of the same name, you’d simply use the shortcode attribute “media_categories” instead:

[[foogallery id="1431" media_categories="adventure"]]Code language: JSON / JSON with Comments (json)

If you want to use more than one tag/category, just separate them with a comma:

[[foogallery id="1431" media_categories="adventure,travel,business"]]Code language: JSON / JSON with Comments (json)

Note that only 1 taxonomy source can be used at a time when adding them in the shortcode, meaning that you cannot add both “media_categories” and “media_tags” attributes to the shortcode.

Note also that the “media_categories” or “media_tags” shortcode attributes can only be used with an existing gallery, which means you will have to always supply the id=”??” attribute.