wpexplorer

Office page-slides.php

Jan 17th, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. <?php
  2. /**
  3. * @package WordPress
  4. * @subpackage Office Theme
  5. */
  6.  
  7. // Get all images attached to the post
  8. $args = array(
  9. 'orderby' => 'menu_order',
  10. 'order' => 'ASC',
  11. 'post_type' => 'attachment',
  12. 'post_parent' => get_the_ID(),
  13. 'post_mime_type' => 'image',
  14. 'post_status' => null,
  15. 'posts_per_page' => -1
  16. );
  17. $attachments = get_posts($args);
  18.  
  19. if( $attachments ) { ?>
  20.  
  21. <?php
  22. // Fire js scripts for pagepage slider
  23. wp_enqueue_script('flexslider', WPEX_JS_DIR_URI .'flexslider.js', array('jquery'), '2.1', true);
  24. wp_enqueue_script('office-page-slides', WPEX_JS_DIR_URI .'page-slider.js', array('jquery','flexslider'), '1.0', true); ?>
  25.  
  26. <div id="slider-wrap">
  27. <div id="full-slides" class="flexslider clearfix">
  28. <ul class="slides">
  29. <?php foreach ($attachments as $attachment) :
  30. $slides_description = $attachment->post_content; ?>
  31. <li class="slide">
  32. <img src="<?php echo aq_resize( wp_get_attachment_url( $attachment->ID ), wpex_img('page_slider_width'), wpex_img('page_slider_height'), wpex_img('page_slider_crop') ); ?>" alt="<?php echo apply_filters('the_title', $attachment->post_title); ?>" />
  33. <?php if(!empty($slides_description)) { ?>
  34. <div class="caption">
  35. <p><?php echo $slides_description; ?></p>
  36. </div><!-- /caption -->
  37. <?php } ?>
  38. </li><!--/slide -->
  39. <?php endforeach; ?>
  40. </ul><!-- /slides -->
  41. </div><!--/full-slides -->
  42. </div><!-- /slider-wrap -->
  43.  
  44. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment