Last active
August 29, 2015 14:12
-
-
Save ericakfranz/0d4a575619a0197c4919 to your computer and use it in GitHub Desktop.
Add Soliloquy slide title to caption output
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 - Titled Captions | |
* Plugin URI: http://soliloquywp.com | |
* Version: 1.0 | |
* Author: Erica Franz | |
* Author URI: http://fatpony.me/ | |
* Description: Add Soliloquy slide title to caption output | |
*/ | |
/** | |
* Add Soliloquy slide title to caption output if title has been defined | |
* | |
* @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_title_before_caption( $caption, $id, $slide, $data, $i ) { | |
// Check if current slide has a title specified | |
if ( isset( $slide['title'] ) && !empty( $slide['title'] ) ) { | |
$caption = '<h4 class="title">' . $slide['title'] . '</h4>'; | |
$caption .= '<div class="caption">' . $slide['caption'] . '</div>'; | |
} | |
return $caption; | |
} | |
add_filter( 'soliloquy_output_caption', 'soliloquy_title_before_caption', 10, 5 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment