Ecommerce Shopify WordPress Discussion

Duplicate Posts Showing in a Slider

I have a php function to call in Wordpress posts and display them as a slider, I want to limit the maximum number of posts shown to 4, but instead, I get the same 4 posts repeating three times. What should I change? <?php $args = [ 'post_type' => 'post', 'posts_per_page' => 3, 'orderby' => 'post_date', 'order' => 'DESC', 'tax_query' => [ [ 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => [ 'post-format-aside', 'post-format-link', 'post-format-quote', 'post-format-status', 'post-format-audio', 'post-format-chat', 'post-format-video', ], 'operator' => 'NOT IN', ], ], ]; $query = new WP_Query( $args ); if ( ! $query->have_posts() ) { return; } ?> <div class="author-recent-posts"> <div class="author-recent-posts__header clear row"> <div class="author-recent-posts__header__inner large-7 small-12 column"> <h2>From The Carlyle Financial Blog</h2> <a href="/blog/">View All <i class="fa-solid fa-long-arrow-alt-right"></i></a> </div> </div> <div class="author-recent-posts__slider"> <?php while ( $query->have_posts() ) : $query->the_post(); ?> <?php $thumb = [get_template_directory_uri() . '/images/carlyle-financial-music-background.jpg']; if ( has_post_thumbnail() ): $thumb = wp_get_attachment_image_src( get_post_thumbnail_id(), 'single-post-thumbnail' ); endif; $thumb = sprintf( 'style="background-image: url(\'%s\')"', esc_url( $thumb[ 0 ] ) ); ?> <div class="author-recent-post-item"> <div class="author-recent-post-item__inner"> <a class="author-recent-post-item__link" href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark"> <span class="sr-only"><?php _e( 'Read more' ); ?></span> </a> <figure class="author-recent-post-item__thumb" <?php echo $thumb; ?>></figure> <div class="author-recent-post-item__header"> <?php the_title( '<h3 class="entry-title">', '</h3>' ); ?> </div> <!-- /.author-recent-post-item__header --> </div> <!-- /.author-recent-post-item__inner --> </div> <!-- /.author-recent-post-item --> <?php endwhile; wp_reset_postdata(); ?> </div> <!-- /.author-recent-posts__slider --> </div> I try reducing 'posts_per_page' => 4, to the number I need, but the maximum number doesn't change, it creates duplicates instead
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.