<?php 
	global $redux_demo; 
	$featured_ads_option = $redux_demo['featured-options-on'];
	$premiumSECtitle = $redux_demo['premium-sec-title'];
	$premiumSECdesc = $redux_demo['premium-sec-desc'];
	$featuredCatOn = $redux_demo['featured-caton'];
	$featuredCat = $redux_demo['featured-ads-cat'];
	$catIcon="";
	$catName="";
?>
	<?php if($featured_ads_option == 1) { ?>
	 <!-- Premium Advertisement -->
 
<section id="premiumAdv" class="removeMargin premiumAdvSection">	 
	<div class="row">
		<div class="mainHeading">
			<div class="large-6 medium-8 large-centered medium-centered columns">
				<h4><?php echo $premiumSECtitle;?></h4>					
				<p><?php echo $premiumSECdesc;?></p>
			</div>
		</div><!--End mainHeading-->
	</div><!--End Heading row-->
	<div class="customNavigation hide-for-small hide-for-medium">
		<div class="row">
			<div class="medium-4 medium-centered columns">
			<?php 
				$previous = $redux_demo['trns-btn-previous'];
				$next = $redux_demo['trns-btn-next'];
				$caraCategory = $redux_demo['trns-cara-cat'];
			?>
				<div class="navText">
					<a class="prev"><i class="fa fa-angle-left"></i></a>
					<span><?php echo $previous;?></span>
					<span><?php echo $next;?></span>
					<a class="next"><i class="fa fa-angle-right"></i></a>
				</div>
			</div>
		</div>
	</div><!--End customNavigation-->
	<!--Start Premium Carousel-->
	<div id="owl-demo" class="owl-carousel removeMargin">
		<?php $cat_id = get_cat_ID(single_cat_title('', false)); 
			global $paged, $wp_query, $wp;
			$args = wp_parse_args($wp->matched_query);
			$temp = $wp_query;
			$wp_query= null;
			$wp_query = new WP_Query();
			
			if($featuredCatOn == 1){
					$wp_query->query('post_type=post&posts_per_page=-1&cat='.$featuredCat.'');
				}else{
					$wp_query->query('post_type=post&posts_per_page=-1');
				}
			//$wp_query->query('post_type=post&posts_per_page=-1');
			$current = -1;
			
		?>
		<?php while ($wp_query->have_posts()) : $wp_query->the_post();
			$featuredMeta = get_post_meta($post->ID, 'featured_post', true);
			if($featuredCatOn == 1){
				$featured_post = "1";
			}else{
				$featured_post = "0";
			}
			$post_price_plan_activation_date = get_post_meta($post->ID, 'post_price_plan_activation_date', true);
			$post_price_plan_expiration_date = get_post_meta($post->ID, 'post_price_plan_expiration_date', true);
			$post_price_plan_expiration_date_noarmal = get_post_meta($post->ID, 'post_price_plan_expiration_date_normal', true);
			$todayDate = strtotime(date('m/d/Y h:i:s'));
			$expireDate = $post_price_plan_expiration_date;
			if(!empty($post_price_plan_activation_date) && $featuredMeta == 1) {
				if(($todayDate < $expireDate) or $post_price_plan_expiration_date == 0) {
					$featured_post = "1";
				}
			}elseif($featuredMeta == 1){
				$featured_post = "1";
			}
		
		?>
		<?php if($featured_post == "1") {
				$current++;
		?>
		<div class="item">
			<div class="carousel">
			<?php 
					if ( has_post_thumbnail()) {
						$imageurl = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'classiera-pslider');
						$thumb_id = get_post_thumbnail_id($post->id);
						$alt = get_post_meta($thumb_id, '_wp_attachment_image_alt', true);			
						
						?>
						<div class="premiumIMG"><img src="<?php echo $imageurl[0]; ?>" alt="<?php if(empty($alt)){echo "Image";}else{ echo $alt; } ; ?>"/></div>
						<?php
					}else{
						?>
						<div class="premiumIMG">
							<img src="<?php echo get_template_directory_uri() . '/images/nothumb/nothumbpslider.png' ?>" alt="No Thumb"/>
						</div>
						<?php
					}
				$postTiti= get_the_title();
				?>
				
			<?php
				$post_price = get_post_meta($post->ID, 'post_price', true);
				$category = get_the_category();
				if ($category[0]->category_parent == 0) {
					$tag = $category[0]->cat_ID;
					$tag_extra_fields = get_option(MY_CATEGORY_FIELDS);
					if (isset($tag_extra_fields[$tag])) {
						$category_icon_code = $tag_extra_fields[$tag]['category_icon_code'];
						$category_icon_color = $tag_extra_fields[$tag]['category_icon_color'];
					}
				}else{
					$tag = $category[0]->category_parent;
					$tag_extra_fields = get_option(MY_CATEGORY_FIELDS);
					if (isset($tag_extra_fields[$tag])) {
						$category_icon_code = $tag_extra_fields[$tag]['category_icon_code'];
						$category_icon_color = $tag_extra_fields[$tag]['category_icon_color'];
					}
				}
				if(!empty($category_icon_code)) {
					$catIcon = stripslashes($category_icon_code);
				}
				$category_icon_code = "";
				$postCatgory = get_the_category( $post->ID );
				if(!empty($post_price)){								
				?>
					<span class="price" style="background-color:<?php echo $category_icon_color; ?>;"><?php echo $post_price; ?></span>
				<?php } ?>
				<div class="hover">
					<?php 
						
					?>
					<a href="<?php the_permalink(); ?>">					
						<span class="info">
							<i class="<?php echo $catIcon; ?>" style="background-color:<?php echo $category_icon_color; ?>;"></i>
							<span class="title"><?php echo $postTiti; ?></span>
							<small><?php echo $caraCategory; ?> : <?php echo $postCatgory[0]->name; ?></small>
						</span>
					</a>
				</div>
			</div>			
		</div>
	<?php }?>
		<?php endwhile; ?>
		<?php wp_reset_query(); ?>			
	</div><!--End Premium Carousel-->
</section><!--End premiumAdv-->
	<?php }?>