The `` shortcode displays photographs from the Mount Dandenong History Society PhotoPrism collections. It can display a specific image by filename, select one or more images using search expressions, and optionally show captions and metadata.
The shortcode automatically uses the Members collection for logged-in users and the Public collection for visitors.
The shortcode can:
- Display a specific photograph by filename.
- Select photographs using search expressions.
- Display a single random matching photograph.
- Display all matching photographs in a gallery.
- Show titles, captions, dates, and other metadata.
- Display metadata without displaying the photograph itself.
- Automatically use the Members catalogue for logged-in users and the Public catalogue for visitors.
Basic Examples
Display a specific photograph. id, the file extension (.jpg or .jpeg) may be omitted.
[mdh-photo id="MTD0013.jpg"]
Display a random photograph matching a search
[mdh-photo search="Olinda"]
Display all matching photographs:
[mdh-photo search="Olinda" gallery="yes"]
Display a title without the photograph
[mdh-photo id="olinda_picnic_1928" image="no" title="yes"]
Display a caption without the photograph
[mdh-photo id="olinda_picnic_1928" image="no" caption="yes"]
Search expressions used to find matching photographs
[mdh-photo search="Olinda"]
[mdh-photo search="Olinda AND picnic"]
[mdh-photo search="(Olinda OR Kalorama) AND railway"]
query is an alias for `search
[mdh-photo query="Olinda"]
Despite its name, this option is not limited to keyword metadata.
The supplied value is treated exactly the same as a search expression and searches whichever fields have been enabled through the search_in_* options.
[mdh-photo keyword="Olinda"]
When multiple photographs match, one matching photograph is selected at random unless gallery mode is enabled.
Search Scope Options
These options determine which metadata fields are searched when using `search`, `query`, or `keyword`.
All of the following options accept “yes” or “no” with self-explanatory meaning.
| Option | Default |
|---|---|
| search_in_title | yes |
| search_in_caption | yes |
| search_in_kw | yes |
| search_in_author | no |
| search_in_source | no |
| search_in_credit | no |
| search_in_instructions | no |
| search_in_job_id | no |
| search_in_copyright | no |
| search_in_date | no |
Examples
Search only in title
[mdh-photo search="Olinda" search_in_title="yes" search_in_caption="no" search_in_kw="no"]
query is an alias for `search
[mdh-photo query="Olinda"]
Display Options
image
Controls whether photographs are displayed.
Values:
- “yes” (default)
- “no”
Examples
Display title only
[mdh-photo id="MTD0013" image="no" title="yes"]
Display caption only
[mdh-photo id="MTD0013" image="no" caption="yes"]
Display title and caption without the photograph
[mdh-photo id="MTD0013" image="no" title="yes" caption="yes"]
gallery
Controls whether all matching photographs are displayed.
Values:
- “yes”
- “no” (default)
Examples
Display all photos with “Olinda” in title, caption or keywords
[mdh-photo search="Olinda" gallery="yes"]
title
Display the photograph title.
Values:
- “yes”
- “no” (default)
Examples
Display a random photo with “Olinda” in title, caption or keywords and show title
[mdh-photo search="Olinda" title="yes"]
caption
Display the photograph caption.
Values:
- “yes”
- “no” (default)
Examples
Display a random photo with “Olinda” in title, caption or keywords and show caption
[mdh-photo search="Olinda" caption="yes"]
link
Makes the displayed photograph clickable and opens a larger version.
Values:
- “yes”
- “no” (default)
Examples
Display a random photo with “Olinda” in title, caption or keywords and make it clickable
Note: This option only applies when `image=”yes”`
[mdh-photo search="Olinda" link="yes"]
width
Sets the maximum display width in pixels.
Example
Display a random photo with “Olinda” in title, caption or keywords and make it 800px wide
[mdh-photo search="Olinda" width="800"]
align
Sets the maximum display width in pixels.
Values:
- “left”
- “center” (default)
- “right”
Example
Display a random photo with “Olinda” in title, caption or keywords and make it right aligned
[mdh-photo search="Olinda" align="right"]
Metadata Display Options
The following fields can be displayed when available.
All accept:
- “yes”
- “no” (default)
author
Displays photographer or creator information
[mdh-photo id="MTD0013" author="yes"]
source
Displays source information
credit
Displays credit information
instructions
Displays special instructions or usage notes
job_id
Displays job or reference information, e.g. Rose postcard number
copyright
Displays copyright information
date
Displays the image date
[mdh-photo id="MTD0013" date="yes"]
Collection Selection
Values:
- “yes”
- “no” (default)
force_public
Forces use of the public catalogue even when logged in.
[mdh-photo search="Olinda" force_public="yes"]
Empty Search Handling
empty_msg
Custom message displayed when neither an ID nor a search expression has been supplied
[mdh-photo empty_msg="Please enter a search term."]
URL Parameters
Many shortcode settings can be overridden using URL parameters.
Examples:
?mdh_title=yes
?mdh_caption=yes
?mdh_image=no
?mdh_search=Olinda
This allows pages to change their displayed photo information dynamically based on URL parameters.
Random Selection Behaviour
When using `search`, `query`, or `keyword` without gallery mode, all matching photographs are collected and one matching photograph is selected at random each time the page is displayed.
Example:
Display a random photo with “Olinda” in title, caption or keywords
[mdh-photo search="Olinda"]
Refreshing the page may display a different matching photograph.
Notes
- ID matching takes priority over search expressions.
- Searches are case-insensitive.
- Search expressions support the same search syntax used throughout the website, including AND, OR and parentheses.
- Gallery mode displays every matching photograph.
- Clicking gallery images opens a larger version in a lightbox viewer.
- Logged-in users automatically access the Members catalogue unless `force_public=”yes”` is specified.
- Setting `image=”no”` allows titles, captions and metadata to be displayed without displaying the photograph itself.
