Skip to content

Instantly share code, notes, and snippets.

@n7studios
Created November 5, 2014 12:54
Show Gist options
  • Save n7studios/27d4d6d28d27471a0257 to your computer and use it in GitHub Desktop.
Save n7studios/27d4d6d28d27471a0257 to your computer and use it in GitHub Desktop.
Soliloquy - Dynamic Start Slide Position
<?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