If you can get an index of your post then utilize %
for CTA breaks.
<?php
// Your CTA Content
$cta_array = array(
"Some different content 1",
"Some different content ABC",
"Some different content XYZ",
);
$cta_inx = 0; // index
$cta_len = count($cta_array); // max
$cta_interval = 5; // breaks every x posts
// Query
$args = array(
'posts_per_page' => 25,
'post_type' => 'post',
'post_status' => 'publish',
'suppress_filters' => true
);
$posts_array = get_posts( $args );
// LOOP
?><div class="news_list"><?php // news_list START
foreach ($posts_array as $inx => $post ){
// News Item
?><div class="news_item"><?php echo $post->post_title; ?></div><?php
// CTA
if( $inx && ! ( $inx % $cta_interval )) {
if( $cta_inx == $cta_len) $cta_inx = 0; // reset the index
?><div class="cta_element" id="cta_<?php echo $cta_inx; ?>"><?php echo $cta_array[$cta_inx]; ?></div><?php
$cta_inx ++; // advance the cta
}
}
?></div><?php // news_list END
That should output:
> Post Title
> Post Title
> Post Title
> Post Title
> Post Title
Some different content 1
> Post Title
> Post Title
> Post Title
> Post Title
> Post Title
Some different content ABC
> Post Title
> Post Title
> Post Title
> Post Title
> Post Title
Some different content XYZ
> Post Title
> Post Title
> Post Title
> Post Title
> Post Title
Some different content 1
> Post Title
> Post Title
> Post Title
> Post Title
> Post Title
Some different content ABC
> Post Title
> Post Title
> Post Title
> Post Title
> Post Title
Some different content XYZ