ajayver

Untitled

Jun 12th, 2014
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.43 KB | None | 0 0
  1. add_action( 'after_setup_theme', 'child_theme_setup', 20 );
  2.  
  3. function child_theme_setup() {
  4.     remove_shortcode( 'fullscreen_slider' );
  5.     add_shortcode( 'fullscreen_slider', 'my_fullscreen_slider' );
  6. }
  7.  
  8. function my_fullscreen_slider($attributes, $content = null)
  9.     {
  10.         $attributes = shortcode_atts(
  11.             array(
  12.                 'interval' => 5000,
  13.                 'transition' => 2,
  14.                 'speed' => 400,
  15.             ), $attributes);
  16.  
  17.         global $first_slide;
  18.         $first_slide = TRUE;
  19.  
  20.         $interval = (is_numeric($attributes['interval']))?round($attributes['interval']):5000;
  21.         $speed = (is_numeric($attributes['speed']))?round($attributes['speed']):400;
  22.         $transition = (in_array($attributes['transition'], array(0, 1, 2, 3, 4, 5, 6, 7)))?$attributes['transition']:2;
  23.  
  24.         $output = '<div class="us_supersized">
  25.                         <a id="prevslide" class="load-item"><i class="fa fa-chevron-left"></i></a>
  26.                         <a id="nextslide" class="load-item"><i class="fa fa-chevron-right"></i></a>
  27.                         <div class="slidecaption">
  28.                             <div id="slidecaption"></div>
  29.                         </div>
  30.                         <ul id="slide-list"></ul>
  31.                     </div>
  32.                     <script type="text/javascript">
  33.                         jQuery(document).ready(function() {
  34.                             jQuery.supersized({
  35.                                 // Functionality
  36.                                 slide_interval : '.$interval.', // Length between transitions
  37.                                 transition : '.$transition.', // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
  38.                                 transition_speed : '.$speed.', // Speed of transition
  39.                                 slide_links :   "blank",   
  40.                                 // Components
  41.                                 slides  : [ // Slideshow Images
  42.                                     '.do_shortcode($content).'
  43.                                 ]
  44.                             });
  45.                         });
  46.                     </script>
  47.                     <style>
  48.                         ul#slide-list {
  49.                             padding: 15px 0;
  50.                             float: left;
  51.                             position: absolute;
  52.                             left: 50%;
  53.                             bottom: 0;
  54.                         }
  55.  
  56.                         ul#slide-list li {
  57.                             list-style: none;
  58.                             width: 12px;
  59.                             height: 12px;
  60.                             float: left;
  61.                             margin: 0 5px 0 0;
  62.                         }
  63.  
  64.                         ul#slide-list li.current-slide a, ul#slide-list li.current-slide a:hover {
  65.                             background-color: grey;
  66.                         }
  67.  
  68.                         ul#slide-list li a {
  69.                             display: block;
  70.                             width: 12px;
  71.                             height: 12px;
  72.                             background-color: white;
  73.                             border-radius: 50%;
  74.                         }
  75.  
  76.                         ul#slide-list li a:hover {
  77.                             background-color: grey;
  78.                             cursor: pointer;
  79.                         }
  80.                     </style>';
  81.  
  82.  
  83.         return $output;
  84.     }
Advertisement
Add Comment
Please, Sign In to add comment