Last active
May 19, 2017 04:12
-
-
Save n7studios/042e6c5f5d3a2a0afd83 to your computer and use it in GitHub Desktop.
Soliloquy - 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
<?php | |
/** | |
* Plugin Name: Soliloquy - Link Captions | |
* Plugin URI: http://soliloquywp.com | |
* Version: 1.0 | |
* Author: Tim Carr | |
* Author URI: http://www.n7studios.co.uk | |
* Description: Link captions to the hyperlink specified on a Soliloquy slide. | |
*/ | |
/** | |
* Link the caption to the hyperlink, if specified | |
* | |
* @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_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'] . '">' . $caption . '</a>'; | |
} | |
return $caption; | |
} | |
add_filter( 'soliloquy_output_caption', 'soliloquy_link_caption', 9999, 5 ); |
I mean to the caption.
I can just add the text, as the whole thing is clickable. :) Problem solved.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is awesome! It works well. I just needed to modify the css. Is it possible to add a read more link?