Created
September 3, 2014 04:33
-
-
Save woogist/57d414c2dfaf9a43382e to your computer and use it in GitHub Desktop.
load memorable feature slider js on all other page except for home
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
add_action( 'woothemes_add_javascript' , 'woo_load_featured_slider_on_all_other_pages_js' ); | |
function woo_load_featured_slider_on_all_other_pages_js() { | |
if ( !is_home() ) { | |
//Slider settings | |
$settings = array( | |
'featured_speed' => '7', | |
'featured_hover' => 'true', | |
'featured_action' => 'true', | |
'featured_touchswipe' => 'true', | |
'featured_animation_speed' => '0.6', | |
'featured_animation' => 'fade' | |
); | |
$settings = woo_get_dynamic_values( $settings ); | |
if ( $settings['featured_speed'] == '0' ) { $slideshow = 'false'; } else { $slideshow = 'true'; } | |
if ( 'true' == $settings['featured_touchswipe'] ) { $touchSwipe = 'true'; } else { $touchSwipe = 'false'; } | |
if ( 'true' == $settings['featured_hover'] ) { $pauseOnHover = 'true'; } else { $pauseOnHover = 'false'; } | |
if ( 'true' == $settings['featured_action'] ) { $pauseOnAction = 'true'; } else { $pauseOnAction = 'false'; } | |
if ( ! in_array( $settings['featured_animation'], array( 'fade', 'slide' ) ) ) { $settings['featured_animation'] = 'fade'; } | |
$slideshowSpeed = (int) $settings['featured_speed'] * 1000; // milliseconds | |
$animationDuration = (int) $settings['featured_animation_speed'] * 1000; // milliseconds | |
$manualControls = ''; | |
$data = array( | |
'animation' => $settings['featured_animation'], | |
'controlsContainer' => '.controls-container', | |
'smoothHeight' => 'true', | |
'directionNav' => 'false', | |
'controlNav' => 'false', | |
'manualControls' => $manualControls, | |
'slideshow' => $slideshow, | |
'pauseOnHover' => $pauseOnHover, | |
'slideshowSpeed' => $slideshowSpeed, | |
'animationDuration' => $animationDuration, | |
'touch' => $touchSwipe, | |
'pauseOnHover' => $pauseOnHover, | |
'pauseOnAction' => $pauseOnAction | |
); | |
wp_localize_script( 'featured-slider', 'woo_localized_data', $data); | |
wp_enqueue_script( 'featured-slider' ); | |
} // End woo_load_featured_slider_js() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment