Skip to content

Instantly share code, notes, and snippets.

@ericakfranz
Last active July 29, 2017 06:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericakfranz/06140de6a74bab49b7ca to your computer and use it in GitHub Desktop.
Save ericakfranz/06140de6a74bab49b7ca to your computer and use it in GitHub Desktop.
Display image title below thumbnails in Envira Gallery
/**
* Plugin Name: Envira Gallery - Image Titles below Thumbnails
* Plugin URI: http://enviragallery.com
* Version: 1.0
* Author: Erica Franz
* Author URI: http://fatpony.me/
* Description: Display titles below images
*/
function envira_gallery_image_titles( $output, $id, $item, $data, $i ) {
// IDs of galleries to display titles on
$galleriesToShowTitles = array(
35,
36
);
// Check if we need to display titles on this gallery
if ( !in_array( $data['id'], $galleriesToShowTitles ) ) {
return $output;
}
if ( isset( $item['title'] )) {
$output .= '<span class="title">' . $item['title'] . '</span>';
}
return $output;
}
add_action( 'envira_gallery_output_after_link', 'envira_gallery_image_titles', 10, 5 );
/* Add some styling to space the title, remember to replace the ID with your gallery's ID */
#envira-gallery-35 .envira-gallery-item span.title {
padding: 20px 5px 30px;
text-align: center;
display: block;
}
@mahdibagherzade
Copy link

how i can add Image Counter below thumbnails?
like this http://enviragallery.com/docs/image-counter-to-album-lightbox/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment