Ecommerce Shopify WordPress Discussion

Video testimonial grid

im trying and trying and trying.... I would like a grid that displays 3 x text only testimonials followed by 2 x video testimonials then repeat im using wp-query to display the info but just cannot get it working. in my head, wp_query finds 3 text only testimonials then displays them then finds 2 video testimonials and display then repeats it. UPDATE BELOW Ive still not got it to work, any further advice? im getting confused and a bit fustrated $args = array( 'post_type' => 'testimonials', 'numberposts' => -1, 'orderby' => 'date', 'order' => 'DESC', 'tax_query' => array( 'relation' => 'OR', array( 'taxonomy' => 'service_types', 'field' => 'slug', 'terms' => array('websites'), ), ), ); $testimonials = get_posts($args); if ($testimonials) : $testimonial_counter = 0; // Initialize the counter $text_count = 0; // Initialize the text testimonial count foreach ($testimonials as $testimonial) : // Check if the post has the tag 'text-only-testimonial' or 'promoted-video-testimonial' $testimonial_tags = wp_get_post_tags($testimonial->ID, array('fields' => 'slugs')); // Display text testimonials if (in_array('text-only-testimonial', $testimonial_tags)) { echo '<div class="text-testimonial">'; echo '<p>' . get_the_content($testimonial->ID) . '</p>'; echo '</div>'; $text_count++; // Check if 3 text testimonials have been displayed if ($text_count == 3) { $text_count = 0; // Reset the text testimonial count echo '<div class="spacer"></div>'; // Add a spacer between text and video testimonials } } // Display video testimonials elseif (in_array('promoted-video-testimonial', $testimonial_tags)) { echo '<div class="video-testimonial">'; // Add your video testimonial display code here echo '</div>'; } $testimonial_counter++; // Check if 2 video testimonials have been displayed if ($testimonial_counter % 5 == 0) { echo '<div class="spacer"></div>'; // Add a spacer between sets of testimonials } endforeach; endif; ?>
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.