Skip to content

Instantly share code, notes, and snippets.

@zamoose
Created February 8, 2012 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zamoose/1764801 to your computer and use it in GitHub Desktop.
Save zamoose/1764801 to your computer and use it in GitHub Desktop.
<?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 );
$c1 = 0;
while( $rotator->have_posts() ): $rotator->the_post();
$rotator_items[$c1] = get_the_post_thumbnail($rotator->get_the_ID());
$c1++;
endwhile;
// Loop through Testimonial items
$testimonial_args = array(
'post_type' => 'testimonial',
'posts_per_page' => $count,
);
$testimonial = new WP_Query($testimonial_args);
$c2 = 0;
while( $testimonial->have_posts() ): $testimonial->the_post();
$return .= '<div>' . get_the_post_thumbnail($testimonial->get_the_ID()) . '</div>';
$return .= '<div>' . $rotator_items[$c2] . '</div>';
$c2++;
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