Skip to content

Instantly share code, notes, and snippets.

@ericakfranz
Last active February 13, 2016 16:28
Show Gist options
  • Save ericakfranz/6dcf938b20546cbc2dfc to your computer and use it in GitHub Desktop.
Save ericakfranz/6dcf938b20546cbc2dfc to your computer and use it in GitHub Desktop.
<?php
/**
* Plugin Name: Envira Gallery - Image Captions below Thumbnails
* Plugin URI: http://enviragallery.com
* Version: 1.0
* Author: Tim Carr
* Author URI: http://www.n7studios.co.uk
* Description: Display captions below images
*/
/**
* Display image captions below thumbnails
*
* @param string $output Output HTML
* @param int $id Image Attachment ID
* @param array $item Image Data
* @param array $data Gallery Data
* @param int $i Image Count
* @return string Output HTML
*/
function envira_gallery_image_captions( $output, $id, $item, $data, $i ) {
if ( isset( $item['caption'] )) {
$output .= '<div class="caption">' . $item['caption'] . '</div>';
}
return $output;
}
add_action( 'envira_gallery_output_after_link', 'envira_gallery_image_captions', 10, 5 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment