<?php                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ?><?php
	$post_type = 'excursii';
	
	$args_new = array(
		'posts_per_page'   => 4,
		//'nopaging'         => true,
		'orderby' => array('menu_order' => 'ASC', 'date' => 'DESC' ),
		'post_type'        => $post_type,
		'post_status'      => 'publish',
		'suppress_filters' => false,
		'tax_query' => array(
			array(
				'taxonomy' => 'status',
				'terms' => array('expirat'),
				'field' => 'slug',
				'operator' => 'NOT IN',
			),
		),
	);
	
	$myposts = new WP_Query( $args_new );
	
	$myposts_count = $myposts->found_posts;
	
	if ( $myposts->have_posts() ) : 
?>
<div class="row excursii-shortcode">
	<?php while ( $myposts->have_posts() ) :$myposts->the_post(); 
		$thumb = wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()), 'large' ); 
		$urlThumb = $thumb['0'];
		$curent_post_id = get_the_ID();
	?>
		<div class="col-sm-6 col-xs-12 excursie excursie-shrotcode">
			<a href="<?php the_permalink(); ?>" class="excursie-prezentare margin-bottom" >
				<span class="thumb">
					<span style="background-image: url('<?php echo $urlThumb; ?>');">
					</span>
				</span>
				<span class="excursie-prezentare-content">
					<span class="display-table">
						<span class="display-table-cell">
							
							<?php 
								$excursieTerm = wp_get_post_terms( get_the_ID(), 'destinatii' )[0]->name; 
							?>
							<span class="term">
								<span>
									<?php echo $excursieTerm; ?>
								</span>
							</span>
							<span class="price">
								<span>
									<?php 
										//_e('Preț: ','theme'); 
										if(get_field('exc_price')){
											if(get_field('exc_price_de_la')){
												_e('de la ','theme'); 
											}
											echo ' <span>';
											the_field('exc_price'); 
											echo '</span>';
										} 
										echo ' ';
										_e('€','theme'); 
									?>
								</span>
							</span>
							<span class="desc">
								<h5><?php the_title(); ?></h5>
							</span>
						</span>
					</span>
				</span>
			</a>
			
		</div>
		
	<?php endwhile; wp_reset_postdata(); ?>
	<?php if(($myposts_count % 2 != 0) && ($myposts_count < 4)){ ?>
		<div class="col-sm-6 col-xs-12 excursie excursie-shrotcode">
			<span class="excursie-prezentare excursie-subscribe">
				<span class="display-table-absolute">
					<span class="display-table">
						<span class="display-table-cell">
							<?php 
								$excursii_shortcode = get_theme_mod( 'excursii_subscribe' );
								echo do_shortcode($excursii_shortcode);
								//echo do_shortcode('[contact-form-7 id="7099" title="Nesletter"]'); 
							?>
						</span>
					</span>
				</span>
			</span>
		</div>
	<?php } ?>
</div>
<?php endif; ?>	