Skip to content

Setting up Search Forms

The search functionality in Sunshine Photo Cart allows customers to quickly find specific images across galleries using keywords, file names, and image metadata. This guide covers how to use the search feature, how it works technically, and how to optimize your images for search.

Using the Search Shortcode

The [sunshine_search] shortcode displays a search form that allows visitors to search for images.

Basic Usage

[sunshine_search]

Learn how to add this custom code to your WordPress website

This displays a search form that searches across all accessible galleries.

Gallery-Specific Search

To limit the search to a specific gallery and its sub-galleries:

[sunshine_search gallery="123"]

Learn how to add this custom code to your WordPress website

Replace 123 with the gallery ID. When searching within a gallery, the search will also include all child/sub-galleries that the user has access to.

Built-in Search Box (Classic Theme)

If you're using the "Classic" theme, you can enable a built-in search box in the gallery display:

  1. Go to Sunshine Photo Cart > Settings > Design
  2. Enable the Gallery Search Box option

This adds a search form directly within gallery pages without needing to manually place the shortcode.

What Gets Searched

When a customer performs a search, Sunshine Photo Cart searches across multiple fields to find matching images:

Field Description Example Match
Image Title The title assigned to the image in WordPress "Smith Family Portrait"
File Name The original file name of the uploaded image "IMG_2847.jpg" or "smith-wedding-001.jpg"
Keywords Keywords embedded in image metadata or added manually "wedding", "bride", "outdoor"
Image Caption The excerpt/caption field of the image "Ceremony at sunset"
Image Description The full description/content of the image Any text in the description field
All Meta Values Any metadata associated with the image Camera info, dates, custom fields

Search Priority

Results are ordered with the most relevant matches first:

  1. Exact title matches appear first
  2. Followed by other matches sorted by date (newest first)

Search Examples

Here are practical examples of how the search works:

Example 1: Searching by File Name

Scenario: A customer from a sports event knows their bib number was 247.

Search term: 247

Would return:

  • bib-247-finish-line.jpg
  • runner-247-starting-block.jpg
  • Any image with "247" in the title, caption, or description

Example 2: Searching by Keywords

Scenario: A customer wants to find all group photos from an event.

Search term: group

Would return:

  • Images with "group" in the title (e.g., "Group Photo at Reception")
  • Images with "group" as a keyword in metadata
  • Images with "group" mentioned in the description

Example 3: Searching by Subject Name

Scenario: A school photography session where student names are in the file names.

Search term: Johnson

Would return:

  • emily-johnson-grade3.jpg
  • johnson-family-portrait.jpg
  • Any image titled "Johnson Family"

Example 4: Searching Within a Gallery

Scenario: A customer is viewing the "Smith Wedding" gallery and wants to find cake photos.

Search term: cake (within gallery context)

Would return:

  • Only images from the Smith Wedding gallery (and sub-galleries) containing "cake" in searchable fields
  • Would NOT return cake photos from other weddings

Managing Keywords in the Admin

Sunshine Photo Cart provides an easy way to view and edit keywords for each image directly in the WordPress admin.

Viewing Image Keywords

  1. Navigate to a gallery in Sunshine Photo Cart > Galleries
  2. Click on an image edit icon to open the attachment details
  3. Look for the Keywords field

Editing Keywords

Keywords are displayed as a comma-separated list. To modify:

  1. Click on the image in the gallery
  2. Find the Keywords field
  3. Enter keywords separated by commas (e.g., wedding, bride, ceremony, outdoor)
  4. Click Save or close the modal to save changes

The best way to make images searchable is to add keywords and metadata before uploading them to WordPress. This saves significant time when uploading large galleries.

Adding Keywords in Photo Editing Software

Adobe Lightroom

  1. Select the images you want to tag
  2. Go to Library module
  3. In the Keywording panel, add keywords
  4. Export with "Include: All Metadata" option

Adobe Photoshop

  1. Go to File > File Info
  2. Click the IPTC Extension or Keywords tab
  3. Add your keywords
  4. Save the file

Adobe Bridge

  1. Select images
  2. Open the Keywords panel
  3. Check existing keywords or add new ones
  4. Save metadata with File > Save Metadata to Files

Photo Mechanic

  1. Select images
  2. Press Cmd/Ctrl + I for IPTC Info
  3. Add keywords in the Keywords field
  4. Apply to selected images

Recommended Keyword Strategy

For best search results, consider adding keywords for:

Category Example Keywords
Event type wedding, portrait, sports, school, corporate
Location outdoor, indoor, beach, church, studio
People bride, groom, family, team, group
Actions ceremony, reception, running, jumping
Time morning, sunset, night
Identifiers Bib numbers, team names, class names

File Naming Best Practices

Since file names are searchable, use descriptive naming:

Good file names:

  • smith-wedding-ceremony-001.jpg
  • bib-247-marathon-finish.jpg
  • johnson-family-portrait-2024.jpg

Poor file names:

  • IMG_2847.jpg
  • DSC00123.jpg
  • photo1.jpg

Batch Renaming Tips

Many tools support batch renaming with patterns:

  • Adobe Lightroom: Export with custom naming template
  • Adobe Bridge: Tools > Batch Rename
  • Photo Mechanic: File > Rename Photos
  • IrfanView (Windows): File > Batch Conversion/Rename

Hooks and Filters

Developers can customize search behavior using these hooks:

Filters

sunshine_search_args

Modify the search query arguments before execution.

add_filter( 'sunshine_search_args', function( $args ) {
    // Limit search to specific post statuses
    $args['post_status'] = 'publish';
    return $args;
});

Learn how to add this custom code to your WordPress website

sunshine_shortcode_search_form

Modify the search form HTML output.

add_filter( 'sunshine_shortcode_search_form', function( $form ) {
    // Add a wrapper div
    return '<div class="custom-search-wrapper">' . $form . '</div>';
});

Learn how to add this custom code to your WordPress website

Actions

sunshine_search

Fires after a search is executed. Receives the search term and results.

add_action( 'sunshine_search', function( $search_term, $results ) {
    // Log search terms for analytics
    error_log( 'Search performed: ' . $search_term . ' - Found: ' . count( $results ) . ' results' );
}, 10, 2 );

Learn how to add this custom code to your WordPress website

sunshine_search_results

Fires when search results are being displayed. Used to render the results template.

// Replace default search results display
remove_action( 'sunshine_search_results', 'sunshine_display_search_results' );
add_action( 'sunshine_search_results', 'my_custom_search_results' );

Learn how to add this custom code to your WordPress website

Still need help?

If you have not yet found your answer in the documentation articles, please contact support

Sunshine Photo Cart for WordPress