Override Image Captions

FooGallery Documentation

Override Image Captions

You can override image captions in FooGallery by following these steps:

First, you will either need to edit your theme’s functions.php or install a plugin that allows you to include custom code snippets. We recommend this plugin: Code Snippets.

In this example, I want to override the caption title to be the image filename, and override the caption description to be the image uploaded date.

This is the code you will need to add:

add_filter( 'foogallery_get_caption_title_for_attachment', 'custom_foogallery_captions', 10, 2 );

function custom_foogallery_captions( $caption, $attachment_post ) {
  return basename( $attachment_post->guid );

add_filter( 'foogallery_get_caption_desc_for_attachment', 'custom_foogallery_caption_description', 10, 2 );

function custom_foogallery_caption_description( $caption, $attachment_post ) {
  return $attachment_post->post_date;