This sounds very tricky. I would try using the Modulus operator to trigger a testimonial query after every 3rd slide.
Thanks graphicgeek. I tried your suggestion using modulus operator and here goes my query below
<?php
global $post;
$args = array(
'orderby' => 'menu_order',
'order' => 'ASC',
'showposts' => 15,
'post_type' => array( 'slideimages' )
);
?>
<div id="slider">
<ul>
<?php
$intervalpost = new WP_Query($args);
$count=1;
while ( $intervalpost->have_posts() ) : $intervalpost->the_post(); global $post; ?>
<li style="color: #fff;"><?php the_content();?></li>
<?php
$count++;
if ($count % 5 == 0 || $count % 9 == 0 || $count % 13 == 0){
$argsnew = array(
'orderby' => 'menu_order',
'order' => 'ASC',
'posts_per_page' => 1,
'offset' => 0,
'post_type' => array( 'testi' )
);
if ($count % 5 == 0 || $count % 9 == 0 || $count % 13 == 0){
}
$the_query = new WP_Query( $argsnew );
while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<li style="color: #fff;"><?php the_title();?> <br /> <?php the_content();?></li>
<?php endwhile;
// Reset Second Loop Post Data
wp_reset_postdata();
}?>
<?php endwhile;
echo '</ul>';
echo '</div>';
?>
Now my problem is that, the result goes this way.
slide 1 -> slide 2 -> slide 3 -> testimonial 1 ->
slide 1 -> slide 2 -> slide 3 -> testimonial 1 ->
slide 1 -> slide 2 -> slide 3 -> testimonial 1 ->
Try using a second counter to count the number of times the testimonial query has been run, something like $testimonialcount, and then use this for $argsnew:
$argsnew = array(
'orderby' => 'menu_order',
'order' => 'ASC',
'posts_per_page' => 1,
'offset' => $testimonialcount,
'post_type' => array( 'testi' )
);
Also, for your if statement, you may be able to simplify it to if($count % 3 == 0) This would return true when the count is 0, 3, 6, 9, etc
Hope that helps.