<?php
/**
 * Custom Portfolio Funtions
 *
 * @package Matrimony
 */

$matrimonial_portfolio_option = get_theme_mod('matrimonial_portfolio_option', 0 );
if ( 0 == $matrimonial_portfolio_option ){
	return;
}

	$matrimony_portfolio_post_one 			= get_theme_mod( 'matrimony_portfolio_post_one','' );  
	$matrimony_portfolio_post_two 							= get_theme_mod( 'matrimony_portfolio_post_two','' );
	$matrimony_portfolio_text_one 			= get_theme_mod( 'matrimony_portfolio_text_one','' );
	$matrimony_portfolio_text_count_one 	= get_theme_mod( 'matrimony_portfolio_text_count_one', '' );
	$matrimony_portfolio_count_two			= get_theme_mod( 'matrimony_portfolio_count_two', '' );
	$matrimony_portfolio_text_count_two 	= get_theme_mod( 'matrimony_portfolio_text_count_two', '' );
	$portfolio_middle_title 				= get_theme_mod( 'matrimony_portfolio_text', '' );
	?>
	<section class="profile-section default-padding">
	    <div class="container">
	        <div class="profile-wrap">
				<?php 
				$portfolio_args  = array(
					'post_type'          =>'post',
					'p'                  => absint( $matrimony_portfolio_post_one ),
					'post_status'        => 'publish',
					'posts_per_page'     =>1
				);
				$portfolio_query = new WP_Query($portfolio_args);
				if ($portfolio_query->have_posts()):
					while ($portfolio_query->have_posts()):
					$portfolio_query->the_post();
					?>
			            <div class="profile-item-wrap animated wow fadeInLeft" data-wow-duration="1s">
			                <div class="profile-item">
			                    <div class="img-wrap">
			                        <figure>
			                             <?php the_post_thumbnail(); ?>
			                        </figure>
			                    </div>
			                    <div class="profile-contain">
			                        <header class="entry-header">
			                            <h4 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
			                        </header>
			                        <div class="profile-designation">
			                        	<?php echo esc_attr(wp_trim_words(get_the_content(),30,'&hellip;')); ?>
			                        </div>
				                    
			                    </div>
			                </div>
			            </div>
					<?php
					endwhile;					
				endif; 
				wp_reset_postdata();
				?>
	            <div class="profile-info animated wow fadeInUp" data-wow-duration="1s">
					<?php if(!empty($portfolio_middle_title)){ ?>
						<h4 class="entry-title"><?php echo esc_html($portfolio_middle_title); ?></h4>
					<?php } ?>
                    <div class="events-countdown">
                        <div>
                        	<?php if(!empty($matrimony_portfolio_text_one)){ ?>
                            	<span class="count-period"><?php echo esc_html($matrimony_portfolio_text_one); ?></span> 
                            <?php } ?>
                            <?php if(!empty($matrimony_portfolio_text_count_one)){ ?>
                            	<span class="count-label"><?php echo esc_html($matrimony_portfolio_text_count_one); ?></span>
                            <?php } ?>
                        </div> 
                        <div>
                    	<?php if(!empty($matrimony_portfolio_count_two)){ ?>
                        	<span class="count-period"><?php echo esc_html($matrimony_portfolio_count_two); ?></span> 
                        <?php } ?>
                        <?php if(!empty($matrimony_portfolio_text_count_two)){ ?>
                            <span class="count-label"><?php echo esc_html($matrimony_portfolio_text_count_two); ?></span>
                        </div> 
                        <?php } ?>
                    </div>
	            </div>
	            <?php 
	            $portfolio_right  = array(
	            	'post_type'        =>'post',
	            	'p'                => absint( $matrimony_portfolio_post_two ),
	            	'post_status'      => 'publish',
	            	'posts_per_page'   =>1
	            );
	            $portfolio_right_query = new WP_Query($portfolio_right);
	            if ($portfolio_right_query->have_posts()):
	            	while ($portfolio_right_query->have_posts()):
	            	$portfolio_right_query->the_post();
	            	?>
			            <div class="profile-item-wrap animated wow fadeInRight" data-wow-duration="1s">
			                <div class="profile-item">
			                    <div class="img-wrap">
			                        <figure>
			                             <?php the_post_thumbnail(); ?>
			                        </figure>
			                    </div>
			                    <div class="profile-contain">
			                        <header class="entry-header">
			                            <h4 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
			                        </header>
			                        <div class="profile-designation">
			                        	<?php echo esc_attr(wp_trim_words(get_the_content(),30,'&hellip;')); ?>
			                        </div>
			                    </div>
			                </div>
			            </div>
	            	<?php
	            	endwhile;	            	
	            endif; 
	            wp_reset_postdata();
	            ?>
	        </div>
	    </div>
	</section> <!--  profile-section end -->
  
