Skip to content

Instantly share code, notes, and snippets.

@ericakfranz
Last active August 29, 2015 14:10
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/1a9041527a9b7732ce51 to your computer and use it in GitHub Desktop.
Save ericakfranz/1a9041527a9b7732ce51 to your computer and use it in GitHub Desktop.
Soliloquy - Lightbox Link Captions
/**
* Plugin Name: Soliloquy - Lightbox Link Captions
* Plugin URI: http://soliloquywp.com
* Version: 1.0
* Author: Erica Franz
* Author URI: http://fatpony.me
* Description: Link captions to image and open in lightbox.
*/
/**
* Link the caption to the slide and open in lightbox, if enabled
*
* @param string $caption Current Slide Caption
* @param int $slideID Current Slide ID
* @param array $slide Current Slide Data
* @param array $data Slider Configuration
* @param int $i Current Slide Index in Slides
* @return string Caption
*/
function soliloquy_lightbox_link_caption( $caption, $id, $slide, $data, $i ) {
// Check if current slide has a link specified
if ( isset( $slide['link'] ) && !empty( $slide['link'] ) ) {
$caption = '<a href="' . $slide['link'] . '" class="soliloquy-link" rel="soliloquybox' . sanitize_html_class( $data['id'] ) . '">' . $caption . '</a>';
}
return $caption;
}
add_filter( 'soliloquy_output_caption', 'soliloquy_lightbox_link_caption', 10, 5 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment