Advertisement
iamdangavin

Functions Enqueue Slideshow

Jul 7th, 2011
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.42 KB | None | 0 0
  1. <?php
  2.  
  3. function collective_enqueue() {
  4.     wp_enqueue_script( 'jquery' );
  5.  
  6.     wp_register_script('collective-jquery-touchwipe', get_bloginfo('stylesheet_directory') .'/scripts/jquery.touchwipe.1.1.1.js', NULL, array('jquery'));
  7.     wp_enqueue_script('collective-jquery-touchwipe');
  8.  
  9.     wp_register_script('collective-jquery-cycle', get_bloginfo('stylesheet_directory') .'/scripts/jquery.cycle.all.js', NULL, array('jquery'));
  10.     wp_enqueue_script('collective-jquery-cycle');
  11.  
  12. }
  13. add_action( 'after_setup_theme', 'collective_enqueue' );
  14.  
  15.  
  16. function collective_scripts() { ?>
  17.    
  18. <?php if (is_front_page()) { ?>
  19.     <script type="text/javascript">
  20.         jQuery(document).ready(function(){
  21.             jQuery('#imagegallery img:first').fadeIn(1000, function() {
  22.                     jQuery('#imagegallery').cycle({
  23.                     fx:     'fade',
  24.                     containerResize: 1,
  25.                     height: 'auto',
  26.                     speed:  1800,
  27.                     timeout: 3400,
  28.                     delay: 2000,
  29.                     prev: '#prev',
  30.                     next: '#next',
  31.                     pauseOnPagerHover: true,
  32.                     cleartype:  1 // enable cleartype corrections
  33.                     });
  34.             jQuery("#imagegallery").touchwipe({
  35.                     wipeLeft: function() {
  36.                     jQuery("#imagegallery").cycle("next");
  37.                 },
  38.                     wipeRight: function() {
  39.                         jQuery("#imagegallery").cycle("prev");
  40.                 }
  41.             });
  42.             });
  43.         });    
  44.     </script>
  45. <?php } ?>
  46.  
  47.  
  48. <?php }
  49. add_action( 'wp_head', 'collective_scripts' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement