HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux WebLive 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wpprm/wp-content/themes/ronneby/woocommerce/best_selling_products.php
<?php

if (!defined('ABSPATH'))
	exit; // Exit if accessed directly

$unique_id = uniqid('bsp_');
$posts_per_page = (!empty($posts_per_page)) ? $posts_per_page : -1;

$args = array(
	'post_type' => 'product',
	'post_status' => 'publish',
	'ignore_sticky_posts' => 1,
	'posts_per_page' => $posts_per_page,
	'meta_key' => 'total_sales',
	'orderby' => 'meta_value_num',
	'meta_query' => array(
		array(
			'key' => '_visibility',
			'value' => array('catalog', 'visible'),
			'compare' => 'IN'
		)
	)
);

$products = new WP_Query($args);

if ($products->have_posts()) :
	?>
	
	<div class="module best-selling-products-wrap products-slider-wrap woocommerce">
		
		<?php if ($show_title) : ?>
		<h4 class="widget-title  text-left widget-title-decoration-underline_label">
			<span><?php _e( 'The best offers', 'dfd' ); ?></span>
		</h4>
		<?php endif; ?>

		<div class="best-selling-products products-slider" id="<?php echo esc_attr($unique_id); ?>">

			<?php woocommerce_product_loop_start(); ?>

			<?php while ($products->have_posts()) : $products->the_post(); ?>

				<?php wc_get_template_part('content', 'product-slider'); ?>

			<?php endwhile; ?>

			<?php woocommerce_product_loop_end(); ?>
			
			<?php echo DFD_Carousel::controls(); ?>
		</div>
		
	</div>

	<script type="text/javascript">
	(function($){
		"use strict";
		$(document).ready(function(){

			$('#<?php echo esc_js($unique_id); ?> .products').slick({
				infinite: false,
				slidesToShow: 4,
				slidesToScroll: 1,
				arrows: false,
				dots: true,
				autoplay: false,//true
				autoplaySpeed: 5000,
				responsive: [
					{
						breakpoint: 1280,
						settings: {
							slidesToShow: 3,
							infinite: true,
							arrows: false,
							dots: true
						}
					},
					{
						breakpoint: 1024,
						settings: {
							slidesToShow: 2,
							infinite: true,
							arrows: false,
							dots: true
						}
					},
					{
						breakpoint: 600,
						settings: {
							slidesToShow: 1,
							arrows: false,
							dots: true
						}
					},
					{
						breakpoint: 480,
						settings: {
							slidesToShow: 1,
							slidesToScroll: 1,
							arrows: false,
							dots: true
						}
					}
				]
			});
		});
		$('#<?php echo esc_js($unique_id); ?> .product').on('mousedown select',(function(e){
			e.preventDefault();
		}));
	})(jQuery);
	</script>
		
<?php

endif;

wp_reset_postdata();