Last active
August 29, 2015 14:10
-
-
Save ericakfranz/1a9041527a9b7732ce51 to your computer and use it in GitHub Desktop.
Soliloquy - Lightbox Link Captions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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