Guest User

Untitled

a guest
Sep 23rd, 2014
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.95 KB | None | 0 0
  1. <div class="wrap container" role="document">
  2.   <div class="content row">
  3.     <main class="main <?php echo roots_main_class(); ?>" role="main">
  4.       <div class="row">
  5.         <div class="col-lg-7">
  6.           <hr>
  7.           <hr>
  8.           <hr>
  9.           <!--------------------------------------------------------------------------------------------------------------------->
  10.          
  11.           <!-- Slider -->
  12.           <div class="row">
  13.             <div class="col-lg-12" id="carousel-bounding-box">
  14.           <?php
  15. $items = new WP_Query(array(
  16.         'post__in' => get_option('sticky_posts'),
  17.         'ignore_sticky_posts' => 1,
  18. 'posts_per_page' => 6,
  19. 'meta_key' => '_thumbnail_id'
  20. ));
  21. $count = $items->found_posts;
  22. ?>
  23.               <div class="carousel slide" id="myCarousel">
  24.                 <!-- Carousel items -->
  25.                 <div class="carousel-inner">
  26.               <?php
  27.         $ctr = 0;
  28.         while ( $items->have_posts() ) :
  29.           $items->the_post();
  30.           $class = $ctr == 0 ? ' active' : '';
  31.         ?>
  32.                   <div class="item<?php echo $class; ?>" data-slide-number="<? the_ID(); ?>">
  33.                    <?php the_post_thumbnail( 'full', array (
  34.                 'class' => 'img-responsive'
  35.                 )); ?>
  36.                 <div class="carousel-caption">
  37.                   <h3><a href="<?php the_permalink(); ?>">
  38.                     <?php the_title(); ?>
  39.                     </a></h3>
  40.                 </div>
  41.                   </div>
  42.               <?php $ctr++;
  43.         endwhile;  ?>
  44.                 </div>
  45.                 <!-- Carousel nav -->
  46.               </div>
  47.             </div>
  48.           </div>
  49.           <!--/Slider-->
  50.          
  51.           <div class="row hidden-phone" id="slider-thumbs">
  52.             <div class="row">
  53.               <div class="col-lg-12">
  54.                 <!-- Bottom switcher of slider -->
  55.                
  56.                 <div class="thumbnails">
  57.                 <?php $counter2 = 0; ?>
  58.                 <?php while ( $items->have_posts() ) : $items->the_post(); ?>
  59.                 <?php $counter2++; ?>
  60.                   <div class="col-lg-2 item <?php echo $counter2 == 1 ? 'active' : ''; ?>">
  61.                   <a class="thumbnail" id="carousel-selector-<? the_ID(); ?>">
  62.                                     <?php
  63.             the_post_thumbnail('thumbnail', array(
  64.                 'class' => 'img-responsive'
  65.             ));
  66.             ?>
  67.                   </a>
  68.                  
  69.                   </div>
  70.                  <?php endwhile; ?>
  71.                  
  72.                  
  73.                 </div>
  74.               </div>
  75.             </div>
  76.           </div>
  77.          
  78.           <!--------------------------------------------------------------------------------------------------------------------->  
  79.          
  80.    
  81.      
  82.     </main>
  83.     <!-- /.main -->
  84.     <?php if (roots_display_sidebar()) : ?>
  85.     <aside class="sidebar <?php echo roots_sidebar_class(); ?>" role="complementary">
  86.       <?php include roots_sidebar_path(); ?>
  87.     </aside>
  88.     <!-- /.sidebar -->
  89.     <?php endif; ?>
  90.   </div>
  91.   <!-- /.content -->
  92. </div>
  93. <!-- /.wrap -->
  94.  
  95. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
  96. <script>
  97.  
  98.   jQuery(document).ready(function($) {
  99.  
  100.         $('#myCarousel').carousel({
  101.                 interval: 5000
  102.         });
  103.  
  104.         $('#carousel-text').html($('#slide-content-0').html());
  105.  
  106.         //Handles the carousel thumbnails
  107.         $('[id^=carousel-selector-]').click( function(){
  108.                 var id_selector = $(this).attr("id");
  109.                 var id = id_selector.substr(id_selector.length -1);
  110.                 var id = parseInt(id);
  111.                 $('#myCarousel').carousel(id);
  112.         });
  113.  
  114.  
  115.  
  116. $('#myCarousel').on('slid.bs.carousel', function(){
  117.    var index = $('.carousel-inner .item.active').index();
  118.    $('.thumbs .item[data-slide-to="'+index+'"]').addClass('active');
  119. });
  120. });
  121. </script>
  122. </body>
  123. </html>
Advertisement
Add Comment
Please, Sign In to add comment