Skip to content

@billerickson /gist:1762204
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
<?php
// Set up arrays to hold the post objects
$rotator_items = $testimonial_items = array();
// Loop through rotator items
$rotator_args = array( 'post_type' => 'rotator' );
$rotator = new WP_Query( $rotator_args );
$count = $rotator->post_count;
while( $rotator->have_posts() ): $rotator->the_post();
$rotator_items[] = $rotator;
endwhile;
// Loop through Testimonial items
$testimonial_args = array(
'post_type' => 'testimonial',
'posts_per_page' => $count,
);
$testimonial = new WP_Query($testimonial_args);
while( $testimonial->have_posts() ): $testimonial->the_post();
$testimonial_items[] = $testimonial;
endwhile;
// Put them together
$loop_counter = 0;
while ( $loop_counter < $count ) :
$rotator_image = get_the_post_thumbnail($rotator_items[$loop_counter]->ID, 'large');
$testimonial_image = get_the_post_thumbnail($testimonial_items[$loop_counter]->ID, 'large');
$return .= '<div>' . $rotator_image . '</div>';
$return .= '<div>' . $testimonial_image . '</div>';
$loop_counter++;
endwhile;
return $return;
// Reset the Query
wp_reset_query();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.