+// Query Posts of custom post type carousel using Foundation 6's Orbit and Advanced Custom Fields for an optional redirect
+$the_query = new WP_Query(
+ 'post_type' => 'carousel',
+if ( $the_query->have_posts() ) {
+ <div class="orbit" role="region" aria-label="Slideshow" data-orbit data-use-m-u-i="false">
+ <ul class="orbit-container">
+ <button class="orbit-previous show-for-medium" aria-label="previous"><span class="show-for-sr">Previous Slide</span>◀</button>
+ <button class="orbit-next show-for-medium" aria-label="next"><span class="show-for-sr">Next Slide</span>▶</button>
+ while ( $the_query->have_posts() ) {
+ $the_query->the_post();
+ echo ' <li class="orbit-slide">
+ // check if the post has a Post Thumbnail assigned to it.
+ if ( has_post_thumbnail() ) {
+ // check if redirect is set
+ $redirect = get_field('redirect_to_url');
+ if ( '' != $redirect ) {
+ echo '<a href="' . $redirect . '">';
+ the_post_thumbnail( 'carousel', [ 'class' => 'orbit-image' , 'loading' => false ] );
+ if ( '' != $redirect ) {
+ $my_excerpt = get_the_post_thumbnail_caption();
+ if ( '' != $my_excerpt ) {
+ echo '<figcaption class="orbit-caption">' . $my_excerpt . '</figcaption>';
+ /* Restore original Post Data */