Guest User

Untitled

a guest
May 24th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. <?php
  2.  
  3. global $post;
  4. $captions = array();
  5.  
  6. echo "<div id=\"slider\" class=\"nivoSlider\">";
  7. $args = array(
  8. 'numberposts' => '-1',
  9. 'orderby' => 'menu_order',
  10. 'order' => 'ASC',
  11. 'post_type' => 'slider_image' );
  12.  
  13.  
  14.  
  15. $images = get_posts($args);
  16.  
  17. for($i=0; $i <= count($images);$i++){
  18.  
  19. if($images[$i]->post_title != ''){
  20. echo get_the_post_thumbnail($images[$i]->ID, 'full', array( 'title' => "#caption".$i+1));
  21.  
  22. array_push($captions, $images[$i]->post_title);
  23.  
  24.  
  25. }
  26. else
  27. {
  28. echo get_the_post_thumbnail($images[$i]->ID, 'full');
  29. }
  30.  
  31. }
  32.  
  33. echo "</div>";
  34.  
  35. print_r($captions);
  36. $count = 1;
  37. foreach($captions as $c => $v){
  38.  
  39. echo "<div id=\"caption".$c++."\" class=\"nivo-html-caption\">";
  40. echo $v;
  41. echo "</div>";
  42.  
  43. count++;
  44. }
  45.  
  46. ?>
Add Comment
Please, Sign In to add comment