Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 10th, 2013  |  syntax: PHP  |  size: 1.35 KB  |  views: 41  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <ul class="slides">
  2. <?php $args = array(
  3.         'post_type' => 'cpt-exhibits-rotator',
  4.         'orderby' => 'menu_order',
  5.         'order' => 'ASC',
  6.         'posts_per_page' => -1
  7. );
  8. $temp = $wp_query;    
  9. $wp_query = null;
  10. $wp_query = new WP_Query($args);
  11.                                                    
  12. if ($wp_query->have_posts()) : while ($wp_query->have_posts()) : $wp_query->the_post();
  13.         setup_postdata($post);
  14.         $rotatorsubhead = get_field('cf-rotator-subhead');
  15.         $attachment_id = get_field('cf-rotator-img-full');
  16.         $size = "slider-full";
  17.         $image = wp_get_attachment_image_src( $attachment_id, $size );
  18.         $fullimg = get_post($attachment_id);
  19.         $alt = get_post_meta($fullimg->ID, '_wp_attachment_image_alt', true);
  20. ?>     
  21.  
  22.         <!-- slide -->
  23.         <li>
  24.  
  25.                 <?php $posts = get_field('cf-rotator-rel');
  26.                 if( $posts ): foreach( $posts as $post): setup_postdata($post);
  27.                         $rotatorurl = get_permalink();
  28.                 ?>
  29.                 <a href="<?php echo $rotatorurl;?>" class="img-frame">
  30.                         <img src="<?php echo $image[0]; ?>" alt="<?php echo $alt; ?>" />
  31.                         <div class="rotator-content">
  32.                                 <span class="item-date"><?php $date = eo_get_the_start('d Y',$post->id, null, $post->occurrence_id); echo $date; ?></span>
  33.  
  34.                                 <h2><?php the_title(); ?></h2>
  35.                         </div>
  36.                 </a>
  37.                 <?php endforeach; wp_reset_postdata(); endif; ?>
  38.         </li>
  39.  
  40.         <?php
  41.                 endwhile; endif;
  42.                 $wp_query = null;
  43.                 $wp_query = $temp;
  44.                 wp_reset_query();
  45.                 ?>
  46. </ul>