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"]

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"]

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" ]

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"]

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"]

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"]