Guest User

Untitled

a guest
Oct 21st, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. <?php
  2. if ( ! is_admin() ) {
  3. add_action( 'wp_print_scripts', 'woothemes_add_javascript' );
  4. add_action( 'wp_print_styles', 'woothemes_add_css' );
  5. }
  6.  
  7. if ( ! function_exists( 'woothemes_add_javascript' ) ) {
  8. function woothemes_add_javascript() {
  9. global $woo_options;
  10.  
  11. wp_register_script( 'slides', get_template_directory_uri() . '/includes/js/slides.min.jquery.js', array( 'jquery' ) );
  12. wp_register_script( 'prettyPhoto', get_template_directory_uri() . '/includes/js/jquery.prettyPhoto.js', array( 'jquery' ) );
  13. wp_register_script( 'jCarousel', get_template_directory_uri() . '/includes/js/jquery.jcarousel.min.js', array( 'jquery' ) );
  14. wp_register_script( 'portfolio', get_template_directory_uri() . '/includes/js/portfolio.js', array( 'jquery', 'prettyPhoto', 'jCarousel', 'slides' ) );
  15. wp_register_script( 'woo-feedback', get_template_directory_uri() . '/includes/js/feedback.js', array( 'jquery', 'slides' ) );
  16. wp_enqueue_script( 'general', get_template_directory_uri().'/includes/js/general.js', array( 'jquery' ) );
  17.  
  18. // Load the JavaScript for the slides and testimonals on the homepage.
  19.  
  20. if ( is_home() ) {
  21. wp_enqueue_script( 'jCarousel' );
  22. wp_enqueue_script( 'slides' );
  23.  
  24. // Load the custom slider settings.
  25.  
  26. $autoStart = false;
  27. $autoSpeed = 6;
  28. $slideSpeed = 0.5;
  29. $effect = 'slide';
  30. $nextprev = 'true';
  31. $pagination = 'true';
  32. $hoverpause = 'true';
  33. $autoheight = 'false';
  34.  
  35. // Get our values from the database and, if they're there, override the above defaults.
  36. $fields = array(
  37. 'autoStart' => 'auto',
  38. 'autoSpeed' => 'interval',
  39. 'slideSpeed' => 'speed',
  40. 'effect' => 'effect',
  41. 'nextprev' => 'nextprev',
  42. 'pagination' => 'pagination',
  43. 'hoverpause' => 'hover',
  44. 'autoHeight' => 'autoheight'
  45. );
  46.  
  47. foreach ( $fields as $k => $v ) {
  48. if ( is_array( $woo_options ) && isset( $woo_options['woo_slider_' . $v] ) && $woo_options['woo_slider_' . $v] != '' ) {
  49. ${$k} = $woo_options['woo_slider_' . $v];
  50. }
  51. }
  52.  
  53. // Set auto speed to 0 if we want to disable automatic sliding.
  54. if ( $autoStart == 'false' ) {
  55. $autoSpeed = 0;
  56. }
  57.  
  58. $data = array(
  59. 'speed' => $slideSpeed,
  60. 'auto' => $autoSpeed,
  61. 'effect' => $effect,
  62. 'nextprev' => $nextprev,
  63. 'pagination' => $pagination,
  64. 'hoverpause' => $hoverpause,
  65. 'autoheight' => $autoHeight
  66. );
  67.  
  68. wp_localize_script( 'general', 'woo_slider_settings', $data );
  69. }
  70.  
  71. // Load the prettyPhoto JavaScript and CSS for use on the portfolio page template.
  72.  
  73. wp_enqueue_script( 'portfolio' );
  74.  
  75. // Conditionally load the Feedback JavaScript, where needed.
  76. $load_feedback_js = false;
  77.  
  78. if ( is_page_template( 'template-feedback.php' ) ) {
  79. $load_feedback_js = true;
  80. }
  81.  
  82. // Allow child themes/plugins to load the Feedback JavaScript when they need it.
  83. $load_feedback_js = apply_filters( 'woo_load_feedback_js', $load_feedback_js );
  84.  
  85. if ( $load_feedback_js ) { wp_enqueue_script( 'woo-feedback' ); }
  86.  
  87. }
  88. }
  89.  
  90. if ( ! function_exists( 'woothemes_add_css' ) ) {
  91. function woothemes_add_css () {
  92.  
  93. wp_register_style( 'prettyPhoto', get_template_directory_uri().'/includes/css/prettyPhoto.css' );
  94.  
  95. wp_enqueue_style( 'prettyPhoto' );
  96.  
  97. } // End woothemes_add_css()
  98. }
  99. ?>
Add Comment
Please, Sign In to add comment