Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 1.70 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Wordpress Caption Array
  2. <?php while ( have_posts() ) : the_post(); ?>
  3.              <?php
  4.                 $argsThumb = array(
  5.                     'orderby' => 'menu_order',
  6.                     'order' => 'ASC',
  7.                     'post_type' => 'attachment',
  8.                     'post_status' => null,
  9.                     'post_parent' => $post->ID,
  10.                     'include'  => $thumb_id
  11.                 );
  12.                $thumb_images = get_posts($argsThumb);
  13.                $currentThumb = 1;
  14.                $captionID=1;
  15.                foreach ($thumb_images as $thumb_image) {
  16.                    if ($currentThumb % 2 == 0)
  17.                         echo '<div class="caption'.$captionID++.'">';
  18.                         echo $thumb_image->post_excerpt;
  19.                         echo '</div>';
  20.                         $currentThumb++;
  21.                }
  22.             ?>
  23.            <?php endwhile; // end of the loop. ?>
  24.        
  25. <div class="caption1"></div>
  26.     BEFORE 3</div>
  27.     <div class="caption2">CLIENT: ELYSIAN<br>AGENCY: IN HOUSE<br>PHOTOG: JEFF SCIORTINO<br><br><p>THIS IMAGE WAS PART OF A SERIES SHOT FOR THE ELYSIAN. I WAS APPROACHED TO ADD ELEMENTS THAT WERE NOT POSSIBLE TO CAPTURE IN CAMERA.</p></div>
  28.     AFTER 2.</div>
  29.     <div class="caption3">BEFORE 1</div>
  30.        
  31. foreach ($thumb_images as $thumb_image) {
  32.     if ($currentThumb % 2 == 0) {
  33.          echo '<div class="caption'.$captionID++.'">';
  34.     }
  35.  
  36.     echo $thumb_image->post_excerpt;
  37.     echo '</div>';
  38.     $currentThumb++;
  39. }
  40.        
  41. foreach ($thumb_images as $thumb_image) {
  42.     if ($currentThumb % 2 == 0) {
  43.          echo '<div class="caption'.$captionID++.'">';
  44.          echo $thumb_image->post_excerpt;
  45.          echo '</div>';
  46.          $currentThumb++;
  47.     }
  48. }