Created
November 5, 2014 12:54
-
-
Save n7studios/27d4d6d28d27471a0257 to your computer and use it in GitHub Desktop.
Soliloquy - Dynamic Start Slide Position
This file contains 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 - Dynamic Start Slide | |
* Plugin URI: http://soliloquywp.com | |
* Version: 1.0 | |
* Author: Tim Carr | |
* Author URI: http://www.n7studios.co.uk | |
* Description: If ?sol_slide=X exists in a Permalink that contains a Soliloquy slider, the slider will start on the given index number (X) | |
*/ | |
/** | |
* Start the slider based on the supplied index | |
* | |
* @param array $data Slider Data | |
* @param int $sliderID Slider ID | |
* @return array Slider Data | |
*/ | |
function soliloquy_dynamic_starting_slide( $data, $sliderID ) { | |
if ( isset( $_GET['sol_slide'] ) ) { | |
$data['config']['start'] = absint( $_GET['sol_slide'] ); | |
$data['config']['random'] = 0; | |
} | |
return $data; | |
} | |
add_filter( 'soliloquy_pre_data', 'soliloquy_dynamic_starting_slide', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment