Guest User

Untitled

a guest
Nov 20th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?php
  2.  
  3. function ba_slider() {
  4. global $post;
  5. $args = array(
  6. 'post_type' => 'rotator',
  7. );
  8.  
  9. $slides = new WP_Query($args);
  10. if ($slides->have_posts()) {
  11. ?>
  12. <div class="flexslider">
  13. <ul class="slides">
  14. <?php
  15. $i = 0;
  16. while ( $slides->have_posts() ) {
  17. $slides->the_post();
  18. $img = get_the_post_thumbnail($post->ID, 'ba_slider');
  19. $prev = ( $i !== 0 ) ? '<a class="prev" href="#">Back</a>' : '';
  20. $next = ( $slides->current_post == ( $slides->found_posts - 1 ) ) ? '' : '<a class="next" href="#">Next</a>'; ?>
  21. <li>
  22. <?php echo $img; ?>
  23. <div class="slidertext">
  24. <h3><?php the_title(); ?></h3>
  25. <p><?php the_content(); ?></p>
  26. <?php echo $prev . $next; ?>
  27. </li>
  28. <?php $i++;
  29. }
  30. ?>
  31. </ul>
  32. </div><?php
  33. }
  34. }
Add Comment
Please, Sign In to add comment