Created
February 7, 2012 21:37
-
-
Save billerickson/1762204 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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