<ul class="slides">
<?php $args = array(
'post_type' => 'cpt-exhibits-rotator',
'orderby' => 'menu_order',
'order' => 'ASC',
'posts_per_page' => -1
);
$temp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query($args);
if ($wp_query->have_posts()) : while ($wp_query->have_posts()) : $wp_query->the_post();
setup_postdata($post);
$rotatorsubhead = get_field('cf-rotator-subhead');
$attachment_id = get_field('cf-rotator-img-full');
$size = "slider-full";
$image = wp_get_attachment_image_src( $attachment_id, $size );
$fullimg = get_post($attachment_id);
$alt = get_post_meta($fullimg->ID, '_wp_attachment_image_alt', true);
?>
<!-- slide -->
<li>
<?php $posts = get_field('cf-rotator-rel');
if( $posts ): foreach( $posts as $post): setup_postdata($post);
$rotatorurl = get_permalink();
?>
<a href="<?php echo $rotatorurl;?>" class="img-frame">
<img src="<?php echo $image[0]; ?>" alt="<?php echo $alt; ?>" />
<div class="rotator-content">
<span class="item-date"><?php $date = eo_get_the_start('d Y',$post->id, null, $post->occurrence_id); echo $date; ?></span>
<h2><?php the_title(); ?></h2>
</div>
</a>
<?php endforeach; wp_reset_postdata(); endif; ?>
</li>
<?php
endwhile; endif;
$wp_query = null;
$wp_query = $temp;
wp_reset_query();
?>
</ul>