<?php
if ( ! class_exists( 'Draly_Dropshipping_Starter_Elementor_Blog' ) ) {
	class Draly_Dropshipping_Starter_Elementor_Blog extends Draly_Dropshipping_Starter_Elementor {
		public $name = 'blog';
		public $title = 'Blog';
		public $icon = 'eicon-post-list';

		/**
		 * Register the widget controls.
		 *
		 * Adds different input fields to allow the user to change and customize the widget settings.
		 *
		 * @since 1.0.0
		 *
		 * @access protected
		 */
		protected function register_controls() {
			//General Section
			$this->start_controls_section(
				'general_section',
				[
					'label' => esc_html__( 'General', 'draly-dropshipping-starter' ),
				]
			);
			$layoutDir = get_template_directory() . '/templates/blog/blog-style/';
			$options   = array();
			if ( is_dir( $layoutDir ) ) {
				$files = scandir( $layoutDir );
				if ( $files && is_array( $files ) ) {
					foreach ( $files as $file ) {
						if ( $file != '.' && $file != '..' ) {
							$fileInfo = pathinfo( $file );
							if ( $fileInfo['extension'] == 'php' && $fileInfo['basename'] != 'index.php' ) {
								$file_data             = get_file_data( $layoutDir . $file, array( 'Name' => 'Name' ) );
								$file_name             = str_replace( 'content-blog-', '', $fileInfo['filename'] );
								$options[ $file_name ] = $file_data['Name'];
							}
						}
					}
				}
			}
			$this->add_control(
				'style',
				[
					'label'       => esc_html__( 'Style', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => $options,
					'default'     => 'style-01',
					'label_block' => true
				]
			);
			$this->add_control(
				'target',
				[
					'label'       => esc_html__( 'Target', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => [
						'category' => esc_html__( 'Category', 'draly-dropshipping-starter' ),
						'posts'    => esc_html__( 'Post(s)', 'draly-dropshipping-starter' ),
					],
					'default'     => 'category',
					'label_block' => true

				]
			);
			$this->add_control(
				'post_ids',
				[
					'label'       => esc_html__( 'Post IDs', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::TEXT,
					'placeholder' => esc_html__( 'Enter IDs', 'draly-dropshipping-starter' ),
					'description' => esc_html__( 'Ex: 1,2,3,...', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'target' => 'posts'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'category_slug',
				[
					'label'       => esc_html__( 'Categorys', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => Draly_Dropshipping_Starter_Elementor::draly_dropshipping_starter_elementor_category(),
					'default'     => '',
					'condition'   => array(
						'target' => 'category'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'per_page',
				[
					'label'       => esc_html__( 'Number Post', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::NUMBER,
					'min'         => 1,
					'max'         => 100,
					'step'        => 1,
					'default'     => 5,
					'condition'   => array(
						'target' => 'category'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'orderby',
				[
					'label'       => esc_html__( 'Orderby', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => [
						'none'     => esc_html__( 'None', 'draly-dropshipping-starter' ),
						'ID'       => esc_html__( 'ID', 'draly-dropshipping-starter' ),
						'author'   => esc_html__( 'Author', 'draly-dropshipping-starter' ),
						'name'     => esc_html__( 'Name', 'draly-dropshipping-starter' ),
						'date'     => esc_html__( 'Date', 'draly-dropshipping-starter' ),
						'modified' => esc_html__( 'Modified', 'draly-dropshipping-starter' ),
						'rand'     => esc_html__( 'Random', 'draly-dropshipping-starter' ),
					],
					'default'     => 'date',
					'condition'   => array(
						'target' => 'category'
					),
					'label_block' => true

				]
			);
			$this->add_control(
				'order',
				[
					'label'       => esc_html__( 'Order', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => [
						'ASC'  => esc_html__( 'Ascending', 'draly-dropshipping-starter' ),
						'DESC' => esc_html__( 'Descending', 'draly-dropshipping-starter' ),
					],
					'default'     => 'DESC',
					'condition'   => array(
						'target' => 'category'
					),
					'label_block' => true
				]
			);
			$this->end_controls_section();
			//Layout Section
			$this->start_controls_section(
				'layout_section',
				[
					'label' => esc_html__( 'Layout', 'draly-dropshipping-starter' ),
				]
			);
			$this->add_control(
				'layout',
				[
					'label'       => esc_html__( 'Layout', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => [
						'carousel' => esc_html__( 'Carousel', 'draly-dropshipping-starter' ),
						'grid'     => esc_html__( 'Grid', 'draly-dropshipping-starter' ),
					],
					'default'     => 'carousel',
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_number_row',
				[
					'label'       => esc_html__( 'The Number Of Rows', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => [
						'1' => esc_html__( '1 Row', 'draly-dropshipping-starter' ),
						'2' => esc_html__( '2 Rows', 'draly-dropshipping-starter' ),
						'3' => esc_html__( '3 Rows', 'draly-dropshipping-starter' ),
						'4' => esc_html__( '4 Rows', 'draly-dropshipping-starter' ),
						'5' => esc_html__( '5 Rows', 'draly-dropshipping-starter' ),
						'6' => esc_html__( '6 Rows', 'draly-dropshipping-starter' ),
					],
					'default'     => '1',
					'condition'   => array(
						'layout' => 'carousel'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_rows_space',
				[
					'label'       => esc_html__( 'Rows Space', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => [
						'rows-space-0'   => esc_html__( 'Default', 'draly-dropshipping-starter' ),
						'rows-space-10'  => esc_html__( '10px', 'draly-dropshipping-starter' ),
						'rows-space-20'  => esc_html__( '20px', 'draly-dropshipping-starter' ),
						'rows-space-30'  => esc_html__( '30px', 'draly-dropshipping-starter' ),
						'rows-space-40'  => esc_html__( '40px', 'draly-dropshipping-starter' ),
						'rows-space-50'  => esc_html__( '50px', 'draly-dropshipping-starter' ),
						'rows-space-60'  => esc_html__( '60px', 'draly-dropshipping-starter' ),
						'rows-space-70'  => esc_html__( '70px', 'draly-dropshipping-starter' ),
						'rows-space-80'  => esc_html__( '80px', 'draly-dropshipping-starter' ),
						'rows-space-90'  => esc_html__( '90px', 'draly-dropshipping-starter' ),
						'rows-space-100' => esc_html__( '100px', 'draly-dropshipping-starter' ),
					],
					'default'     => 'rows-space-0',
					'condition'   => array(
						'layout' => 'carousel'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_vertical',
				[
					'label'       => esc_html__( 'Vertical Slide Mode', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => [
						'true'  => esc_html__( 'Yes', 'draly-dropshipping-starter' ),
						'false' => esc_html__( 'No', 'draly-dropshipping-starter' ),
					],
					'default'     => 'false',
					'condition'   => array(
						'layout' => 'carousel'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_verticalswiping',
				[
					'label'       => esc_html__( 'Vertical Swipe Mode', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => [
						'true'  => esc_html__( 'Yes', 'draly-dropshipping-starter' ),
						'false' => esc_html__( 'No', 'draly-dropshipping-starter' ),
					],
					'default'     => 'false',
					'condition'   => array(
						'layout'       => 'carousel',
						'owl_vertical' => 'true'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_autoplay',
				[
					'label'       => esc_html__( 'AutoPlay', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => [
						'true'  => esc_html__( 'Yes', 'draly-dropshipping-starter' ),
						'false' => esc_html__( 'No', 'draly-dropshipping-starter' ),
					],
					'default'     => 'false',
					'description' => esc_html__( 'Enables Autoplay', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout' => 'carousel'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_autoplayspeed',
				[
					'label'       => esc_html__( 'Autoplay Speed', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::NUMBER,
					'min'         => 1000,
					'default'     => 3000,
					'description' => esc_html__( 'Autoplay Speed in milliseconds', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout'       => 'carousel',
						'owl_autoplay' => 'true'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_navigation',
				[
					'label'       => esc_html__( 'Navigation', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => [
						'true'  => esc_html__( 'Yes', 'draly-dropshipping-starter' ),
						'false' => esc_html__( 'No', 'draly-dropshipping-starter' ),
					],
					'default'     => 'false',
					'description' => esc_html__( 'Prev/Next Arrows', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout' => 'carousel'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_dots',
				[
					'label'       => esc_html__( 'Dots', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => [
						'true'  => esc_html__( 'Yes', 'draly-dropshipping-starter' ),
						'false' => esc_html__( 'No', 'draly-dropshipping-starter' ),
					],
					'default'     => 'true',
					'description' => esc_html__( 'Show dot indicators', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout' => 'carousel'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_loop',
				[
					'label'       => esc_html__( 'Loop', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => [
						'true'  => esc_html__( 'Yes', 'draly-dropshipping-starter' ),
						'false' => esc_html__( 'No', 'draly-dropshipping-starter' ),
					],
					'default'     => 'false',
					'description' => esc_html__( 'Infinite loop sliding', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout' => 'carousel'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_slidespeed',
				[
					'label'       => esc_html__( 'Slide Speed', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::NUMBER,
					'min'         => 300,
					'default'     => 300,
					'description' => esc_html__( 'Slide Speed in milliseconds', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout' => 'carousel'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_ls_items',
				[
					'label'       => esc_html__( 'Items per row on Wide Screens', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::NUMBER,
					'min'         => 1,
					'step'        => 1,
					'default'     => 3,
					'description' => esc_html__( 'Items per row on screen resolution of device >= 1400px', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout' => 'carousel'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_slide_margin',
				[
					'label'       => esc_html__( 'Margin on Wide Screens', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::NUMBER,
					'min'         => 0,
					'default'     => 30,
					'description' => esc_html__( 'Distance( or space) between 2 items on screen resolution of device >= 1400px', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout'       => 'carousel',
						'owl_vertical' => 'false'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_lg_items',
				[
					'label'       => esc_html__( 'Items per row on Desktop', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::NUMBER,
					'min'         => 1,
					'step'        => 1,
					'default'     => 3,
					'description' => esc_html__( 'Items per row on screen resolution of device >= 1200px and < 1400px', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout' => 'carousel'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_lg_slide_margin',
				[
					'label'       => esc_html__( 'Margin on Desktop', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::NUMBER,
					'min'         => 0,
					'default'     => 30,
					'description' => esc_html__( 'Distance( or space) between 2 items on screen resolution of device >= 1200px and < 1400px', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout'       => 'carousel',
						'owl_vertical' => 'false'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_md_items',
				[
					'label'       => esc_html__( 'Items per row on Landscape Tablet', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::NUMBER,
					'min'         => 1,
					'step'        => 1,
					'default'     => 3,
					'description' => esc_html__( 'Items per row on screen resolution of device >=992px and < 1200px', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout' => 'carousel'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_md_slide_margin',
				[
					'label'       => esc_html__( 'Margin on Landscape Tablet', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::NUMBER,
					'min'         => 0,
					'default'     => 20,
					'description' => esc_html__( 'Distance( or space) between 2 items on screen resolution of device >=992px and < 1200px', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout'       => 'carousel',
						'owl_vertical' => 'false'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_sm_items',
				[
					'label'       => esc_html__( 'Items per row on Tablet', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::NUMBER,
					'min'         => 1,
					'step'        => 1,
					'default'     => 2,
					'description' => esc_html__( 'Items per row on screen resolution of device >=768px and < 992px', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout' => 'carousel'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_sm_slide_margin',
				[
					'label'       => esc_html__( 'Margin on Tablet', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::NUMBER,
					'min'         => 0,
					'default'     => 20,
					'description' => esc_html__( 'Distance( or space) between 2 items on screen resolution of device >=768px and < 992px', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout'       => 'carousel',
						'owl_vertical' => 'false'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_xs_items',
				[
					'label'       => esc_html__( 'Items per row on Mobile Landscape', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::NUMBER,
					'min'         => 1,
					'step'        => 1,
					'default'     => 2,
					'description' => esc_html__( 'Items per row on screen resolution of device >=576px and < 768px', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout' => 'carousel'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_xs_slide_margin',
				[
					'label'       => esc_html__( 'Margin on Mobile Landscape', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::NUMBER,
					'min'         => 0,
					'default'     => 20,
					'description' => esc_html__( 'Distance( or space) between 2 items on screen resolution of device >=576px and < 768px', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout'       => 'carousel',
						'owl_vertical' => 'false'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_ts_items',
				[
					'label'       => esc_html__( 'Items per row on Mobile', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::NUMBER,
					'min'         => 1,
					'step'        => 1,
					'default'     => 1,
					'description' => esc_html__( 'Items per row on screen resolution of device < 576px', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout' => 'carousel'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'owl_ts_slide_margin',
				[
					'label'       => esc_html__( 'Margin on Mobile', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::NUMBER,
					'min'         => 0,
					'default'     => 10,
					'description' => esc_html__( 'Distance( or space) between 2 items on screen resolution of device < 576px', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout'       => 'carousel',
						'owl_vertical' => 'false'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'boostrap_rows_space',
				[
					'label'       => esc_html__( 'Rows space', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => [
						'rows-space-0'   => esc_html__( 'Default', 'draly-dropshipping-starter' ),
						'rows-space-10'  => esc_html__( '10px', 'draly-dropshipping-starter' ),
						'rows-space-20'  => esc_html__( '20px', 'draly-dropshipping-starter' ),
						'rows-space-30'  => esc_html__( '30px', 'draly-dropshipping-starter' ),
						'rows-space-40'  => esc_html__( '40px', 'draly-dropshipping-starter' ),
						'rows-space-50'  => esc_html__( '50px', 'draly-dropshipping-starter' ),
						'rows-space-60'  => esc_html__( '60px', 'draly-dropshipping-starter' ),
						'rows-space-70'  => esc_html__( '70px', 'draly-dropshipping-starter' ),
						'rows-space-80'  => esc_html__( '80px', 'draly-dropshipping-starter' ),
						'rows-space-90'  => esc_html__( '90px', 'draly-dropshipping-starter' ),
						'rows-space-100' => esc_html__( '100px', 'draly-dropshipping-starter' ),
					],
					'default'     => 'rows-space-0',
					'condition'   => array(
						'layout' => 'grid'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'boostrap_items',
				[
					'label'       => esc_html__( 'Items per row on Extra small devices (e.g., phones) - default for anything smaller', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => [
						'12' => esc_html__( '1 item', 'draly-dropshipping-starter' ),
						'6'  => esc_html__( '2 items', 'draly-dropshipping-starter' ),
						'4'  => esc_html__( '3 items', 'draly-dropshipping-starter' ),
						'3'  => esc_html__( '4 items', 'draly-dropshipping-starter' ),
						'15' => esc_html__( '5 items', 'draly-dropshipping-starter' ),
						'2'  => esc_html__( '6 items', 'draly-dropshipping-starter' ),
					],
					'default'     => '12',
					'description' => esc_html__( 'Screen resolution of device >= 0px', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout' => 'grid'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'boostrap_sm_items',
				[
					'label'       => esc_html__( 'Items per row on Small devices (e.g., phones in landscape mode)', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => [
						'12' => esc_html__( '1 item', 'draly-dropshipping-starter' ),
						'6'  => esc_html__( '2 items', 'draly-dropshipping-starter' ),
						'4'  => esc_html__( '3 items', 'draly-dropshipping-starter' ),
						'3'  => esc_html__( '4 items', 'draly-dropshipping-starter' ),
						'15' => esc_html__( '5 items', 'draly-dropshipping-starter' ),
						'2'  => esc_html__( '6 items', 'draly-dropshipping-starter' ),
					],
					'default'     => '6',
					'description' => esc_html__( 'Screen resolution of device >= 576px', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout' => 'grid'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'boostrap_md_items',
				[
					'label'       => esc_html__( 'Items per row on Medium devices (e.g., tablets)', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => [
						'12' => esc_html__( '1 item', 'draly-dropshipping-starter' ),
						'6'  => esc_html__( '2 items', 'draly-dropshipping-starter' ),
						'4'  => esc_html__( '3 items', 'draly-dropshipping-starter' ),
						'3'  => esc_html__( '4 items', 'draly-dropshipping-starter' ),
						'15' => esc_html__( '5 items', 'draly-dropshipping-starter' ),
						'2'  => esc_html__( '6 items', 'draly-dropshipping-starter' ),
					],
					'default'     => '6',
					'description' => esc_html__( 'Screen resolution of device >= 768px', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout' => 'grid'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'boostrap_lg_items',
				[
					'label'       => esc_html__( 'Items per row on Large devices (e.g., small laptops)', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => [
						'12' => esc_html__( '1 item', 'draly-dropshipping-starter' ),
						'6'  => esc_html__( '2 items', 'draly-dropshipping-starter' ),
						'4'  => esc_html__( '3 items', 'draly-dropshipping-starter' ),
						'3'  => esc_html__( '4 items', 'draly-dropshipping-starter' ),
						'15' => esc_html__( '5 items', 'draly-dropshipping-starter' ),
						'2'  => esc_html__( '6 items', 'draly-dropshipping-starter' ),
					],
					'default'     => '4',
					'description' => esc_html__( 'Screen resolution of device >= 992px', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout' => 'grid'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'boostrap_xl_items',
				[
					'label'       => esc_html__( 'Items per row on Extra large devices (e.g., desktops)', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => [
						'12' => esc_html__( '1 item', 'draly-dropshipping-starter' ),
						'6'  => esc_html__( '2 items', 'draly-dropshipping-starter' ),
						'4'  => esc_html__( '3 items', 'draly-dropshipping-starter' ),
						'3'  => esc_html__( '4 items', 'draly-dropshipping-starter' ),
						'15' => esc_html__( '5 items', 'draly-dropshipping-starter' ),
						'2'  => esc_html__( '6 items', 'draly-dropshipping-starter' ),
					],
					'default'     => '4',
					'description' => esc_html__( 'Screen resolution of device >= 1200px', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout' => 'grid'
					),
					'label_block' => true
				]
			);
			$this->add_control(
				'boostrap_xxl_items',
				[
					'label'       => esc_html__( 'Items per row on Extra extra large devices (e.g., large desktops or high-res displays)', 'draly-dropshipping-starter' ),
					'type'        => \Elementor\Controls_Manager::SELECT,
					'options'     => [
						'12' => esc_html__( '1 item', 'draly-dropshipping-starter' ),
						'6'  => esc_html__( '2 items', 'draly-dropshipping-starter' ),
						'4'  => esc_html__( '3 items', 'draly-dropshipping-starter' ),
						'3'  => esc_html__( '4 items', 'draly-dropshipping-starter' ),
						'15' => esc_html__( '5 items', 'draly-dropshipping-starter' ),
						'2'  => esc_html__( '6 items', 'draly-dropshipping-starter' ),
					],
					'default'     => '4',
					'description' => esc_html__( 'Screen resolution of device >= 1400px', 'draly-dropshipping-starter' ),
					'condition'   => array(
						'layout' => 'grid'
					),
					'label_block' => true
				]
			);
			$this->end_controls_section();

		}

		/**
		 * Render the widget output on the frontend.
		 *
		 * Written in PHP and used to generate the final HTML.
		 *
		 * @since 1.0.0
		 *
		 * @access protected
		 */
		protected function render() {
			$atts         = $this->get_settings_for_display();
			$css_class    = array( 'draly-blog' );
			$css_class[]  = $atts['style'];
			$owl_settings = '';
			$list_class   = array();
			$item_class   = array( 'post-item' );
			if ( $atts['layout'] == 'grid' ) {
				$list_class[] = 'blog-list-grid row';
				$item_class[] = $atts['boostrap_rows_space'];
				$item_class[] = 'col-' . $atts['boostrap_items'];
				$item_class[] = 'col-sm-' . $atts['boostrap_sm_items'];
				$item_class[] = 'col-md-' . $atts['boostrap_md_items'];
				$item_class[] = 'col-lg-' . $atts['boostrap_lg_items'];
				$item_class[] = 'col-xl-' . $atts['boostrap_xl_items'];
				$item_class[] = 'col-xxl-' . $atts['boostrap_xxl_items'];
			}
			if ( $atts['layout'] == 'carousel' ) {
				$list_class[] = 'blog-list-owl owl-slick';
				$item_class[] = $atts['owl_rows_space'];
				$owl_settings .= Draly_Dropshipping_Starter_Helper::carousel_data_attributes( 'owl_', $atts );
			}
			$args = array(
				'post_type'           => 'post',
				'post_status'         => 'publish',
				'ignore_sticky_posts' => 1,
				'posts_per_page'      => $atts['per_page'],
				'suppress_filter'     => true,
				'orderby'             => $atts['orderby'],
				'order'               => $atts['order']
			);
			if ( $atts['target'] == 'category' ) {
				/* Get category id*/
				if ( $atts['category_slug'] ) {
					$idObj = get_category_by_slug( $atts['category_slug'] );
					if ( is_object( $idObj ) ) {
						$args['cat'] = $idObj->term_id;
					}
				}
			}
			if ( $atts['target'] == 'posts' ) {
				$args['post__in'] = array_map( 'trim', explode( ',', $atts['post_ids'] ) );
				$args['orderby']  = 'post__in';
			}
			$posts = new WP_Query( $args );
			?>
            <div class="<?php echo esc_attr( implode( ' ', $css_class ) ); ?>">
				<?php if ( $posts->have_posts() ) : ?>
                    <div class="<?php echo esc_attr( implode( ' ', $list_class ) ); ?>" <?php echo esc_attr( $owl_settings ); ?>>
						<?php while ( $posts->have_posts() ) : $posts->the_post(); ?>
                            <article <?php post_class( $item_class ); ?>>
								<?php get_template_part( '/templates/blog/blog-style/content-blog', $atts['style'] ); ?>
                            </article>
						<?php endwhile; ?>
                    </div>
				<?php else : ?>
                    <p><?php esc_html_e( 'No Content', 'draly-dropshipping-starter' ); ?></p>
				<?php endif; ?>
            </div>
			<?php wp_reset_postdata();
		}
	}
}