[gallery_select_field]

The shortcode is designed to generate a select dropdown field that allows users to choose a gallery from a list of available galleries.


Product


Shortcode Attributes

There are a number of shortcode attributes available which you can use to customise the output.

  1. label – The label text that will be displayed above the select dropdown.
    • Options: Any text value.
  2. placeholder – The placeholder text that will be displayed in the select dropdown when no option is selected.
    • Default: Select Gallery.
    • Options: Any text value.
  3. categories – Gallery Category IDs.
    • Options: Any numeric value. Use commas , to separate.
  4. tags – Gallery Tag IDs.
    • Options: Any numeric value. Use commas , to separate.
  5. orderby – Sort gallery items by a specific field.
    • Default: title.
    • Options: id, date, title, menu_order, rand. Specify one only.
  6. order – Order of the gallery items.
    • Default: asc.
    • Options: asc, desc. Specify one only.

Example Usage

[gallery_select_field label="Select a Gallery" placeholder="Choose a Gallery"]
[gallery_select_field categories="1,2" tags="3,4" orderby="date" order="DESC" label="Select a Gallery" placeholder="Choose a Gallery"]

Results

Example 1:
This example display a select dropdown with all available galleries, ordered by title in ascending order.

Example 2:
This example display a select dropdown with galleries that belong to categories with IDs 1 and 2, are associated with tags with IDs 3 and 4, and are ordered by date in descending order.
If you do not have any posts of the type gallery, the select dropdown will be empty.