Skip to content

Instantly share code, notes, and snippets.

@jocastaneda
Created July 17, 2014 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jocastaneda/832d8771380df6ad98e1 to your computer and use it in GitHub Desktop.
Save jocastaneda/832d8771380df6ad98e1 to your computer and use it in GitHub Desktop.
add_action( 'customize_register', 'slug_customizer' );
function slug_customizer( $customizer ){
$sliders = array();
if ( class_exists( 'Soliloquy_Lite' ) || class_exists( 'Soliloquy' ) )
$sliders['soliloquy'] = 'Soliloquy';
if ( class_exists( 'MetaSliderPlugin' ) )
$sliders['metaslider'] = 'Meta Slider';
if( !empty( $sliders ) ){
$customizer->add_section( 'slider_selection', array(
'title' => __( 'Slider selection', 'slug' ),
'description' => __( 'Use an id and the slider ( if more than one )', 'slug' ),
'priority' => 21 ) );
$customizer->add_setting( 'slider_name', array(
'default' => '' ) );
$customizer->add_setting( 'slider_id', array(
'default' => '' ) );
// setup select choices
foreach( $sliders as $slider => $name ){
$choices[ $slider ] = __( "$name", 'slug' );
}
$customizer->add_control( 'slider_name', array(
'label' => __( 'Choose a slider', 'slug' ),
'section' => 'slider_selection',
'type' => 'select',
'choices' => $choices ) );
$customizer->add_control( 'slider_id', array(
'label' => __( 'Use the slider ID', 'slug' ),
'section' => 'slider_selection',
'type' => 'text' ) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment