WPThumbs
Themes Plugins By purpose By industry Best-of lists Fix it guides
Free Plugin by mark l chaves v1.4.0

Gallery Image Captions

Gallery Image Captions (GIC) allows you to customise WordPress gallery image captions.

Gallery Image Captions

The facts

Rating
5★ from 1
Active installs
100+
Price
Free
Last updated
18 Dec 2022
Added
Mar 2020
Requires WP
5.3.2
Tested up to
WP 6.1.12
Requires PHP
7.2
Downloads
3,854

Our analysis

AI-assisted

Gallery Image Captions (GIC) is a WordPress plugin that allows you to display additional image attributes such as title, caption, and description in your galleries. It modifies the default WordPress gallery shortcode to enable custom filtering of image captions, making it suitable for users who want more control over how their image captions appear.

After installing and activating the plugin, you can write a filter to customize the gallery image captions. This is particularly useful for photography enthusiasts or anyone looking to enhance their image galleries with more detailed information.

Best for: This plugin is best for photographers and WordPress users who want to enhance their gallery captions.

What it does well

  • Displays title, caption, and description for images
  • Allows custom filtering of gallery image captions
  • Easy to integrate with existing WordPress galleries

Where it falls short

  • Requires some coding knowledge to fully utilize
  • Limited information available on usage and support

Verdict

Gallery Image Captions (GIC) offers useful features for customising image captions, but it may require technical knowledge to implement effectively.

From the developer

mark l chaves's own description of Gallery Image Captions, lightly tidied.

With GIC, you can display the title, caption, and description image attributes. You can also change/filter the rendering HTML to whatever you want.

After installing and activating GIC, write your filter and add the WordPress Gallery shortcode to your page.

If you’ve been dreaming of writing a filter to customise the gallery image captions, then this plugin is for you.

Motivation

The default WordPress gallery shortcode will only display the caption from the media’s attachment metadata. Sometimes it’s nice to display more like the title—even the description.

The GIC plugin overrides the WordPress gallery shortcode function to create a hook. With this hook you can do a little bit more than just displaying the caption.

Some premium themes hide the caption completely. This leaves photography lovers like me scratching their head and spending precious time cobbling together makeshift caption blocks.

Usage

Custom Filter For Displaying Captions

The crux of this plugin is the ability to filter the gallery image caption. The galimgcaps_gallery_image_caption hook makes this possible.

For the usage examples below, this is the filter used.

/**
 * Custom Filter for Gallery Image Captions
 *
 * Note: Avoid altering captiontag, selector, and itemtag.
 */
function mlc_gallery_image_caption($attachment_id, $captiontag, $selector, $itemtag) {

    $id = $attachment_id;

    // Grab the meta from the GIC plugin.
    $my_image_meta = galimgcaps_get_image_meta($id);

    /**
     * Here's where to customise the caption content.
     * 
     * This example uses the meta title, caption, and description. 
     * 
     * You can display any value from the $my_image_meta array. 
     * You can add your own HTML too.
     */
    return "<{$captiontag} class='wp-caption-text gallery-caption' id='{$selector}-{$id}'>" .
            "Title: " . $my_image_meta['title'] . "<br>" .
            "Caption: " . $my_image_meta['caption'] . "<br>". 
            "Description: ". $my_image_meta['description'] . 
        "</{$captiontag}></{$itemtag}>";

}
add_filter('galimgcaps_gallery_image_caption', 'mlc_gallery_image_caption', 10, 4);

Feel free to use this filter code as a starter template. After activating the GIC plugin, add the code above to your child theme’s functions.php file. Rename the function and tweak the return string to suit your needs.

New Filter To Get Custom Fields

/**
 * New GIC 1.4.0 filter for custom meta fields.
 */
function gic_add_custom_fields( $image_meta, $attachment ) {

    // This is how you add a custom fields to the array that
    // GIC uses to display captions.
    $image_meta['credit_text'] = $attachment->credit_text;
    $image_meta['credit_link'] = $attachment->credit_link;

    return $image_meta;
}
add_filter( 'galimgcaps_image_meta', 'gic_add_custom_fields', 10, 2 );

To use these two custom fields, your galimgcaps_gallery_image_caption would look something like this.

Read the full description on the official page →

Tagged as

Alternatives

Other plugins for photo galleries.

Smart Slider 3

Responsive slider plugin to create sliders in visual editor easily. Build beautiful image slider, layer slider...

Free 800k+ installs 4.9★ (1,123)
Gallery

Gallery

91

FooGallery is a fast, responsive photo gallery and image gallery plugin with 7 gallery layouts, built-in light...

Free 100k+ installs 4.8★ (986)
Firelight Lightbox

Formerly Easy Fancybox. The most popular WordPress lightbox plugin. Simple, fast, and responsive. Opens images...

Free 200k+ installs 4.8★ (355)
Feeds for YouTube

The Feeds for YouTube plugin allows you to display customizable YouTube feeds from any YouTube channel.

Free 100k+ installs 4.9★ (200)