<?php



if (!function_exists('payamava_list_post')) {
	function payamava_list_post($query = 'recent_post', $count = 6, $ids = null, $cat = null)
	{

		$args_post = [
			'post_type' => 'post',
			'posts_per_page' => $count,
			'orderby' => 'date',
			'order' => 'DESC',
			'post_status' => 'publish',
		];

		if ($query == 'custom_post' && $ids) {

			$args_post['post__in'] = $ids;
			$args_post['orderby'] = 'post__in';
		}

		if ($query == 'cat_post' && $cat) {
			$args_post['tax_query'] = [
				[
					'taxonomy' => 'category',
					'field' => 'term_id',
					'terms' => $cat,
				],
			];
		}


		$post = new WP_Query($args_post);

		$html = '';

		if ($post->have_posts()) {
			ob_start();
			while ($post->have_posts()) {

				$post->the_post();


				echo '<div class="swiper-slide">';

				get_template_part('template-parts/cards/content', 'post');

				echo '</div>';

			}

			$html = ob_get_clean();

			wp_reset_postdata();

		}

		return $html;
	}
}








?>