<?php
/**
 * This Temaplate is display single post
 *
 * @package Krown
 * @subpackage Krown
 * @since Krown 1.0
 */
?>
<?php get_template_part( 'single', 'header' ); ?>
<?php get_template_part( 'top', 'menu' );?>

<!-- Single Page Layout 3 -->
<?php
    global $tlazya_krwn;
    switch($tlazya_krwn['single_layout']) {
    case "3":
?>      

<!-- #work-single -->
<section id="work-single" class="work-single section">
	<div class="container">

		<div class="page-title">
			<?php if (function_exists('my_breadcrumbs')) my_breadcrumbs(); ?>
		</div>


		<div class="row">
			<?php
				while ( have_posts() ) : the_post();
				$company = get_post_meta(get_the_ID(), 'company', TRUE);
				$budget = get_post_meta(get_the_ID(), 'budget', TRUE);
				$website = get_post_meta(get_the_ID(), 'website', TRUE);
				$ida = get_post_thumbnail_id( get_the_ID(), 'port_large' );
				if(has_post_thumbnail( get_the_ID() ))
				{
					$port_large = get_the_post_thumbnail(get_the_ID(), 'port_large');
				}
				else
				{
					$port_large = '<img src="http://placehold.it/750x750" alt="Portfolio Image"/>';
				}
			?>
			<div class="col-md-8">
				<?php
					if ( has_post_format( 'image' ))
					{
				?>
				
				<div class="media">
					<a href="<?php echo wp_get_attachment_url($ida); ?>" class="lightbox">
						<img src="<?php echo wp_get_attachment_url($ida); ?>" alt="" class="img-responsive" />
					</a>
				</div>
				
				<?php
					}
					elseif ( has_post_format( 'video' ))
					{
				?>
				
				<div class="media fit">
					<iframe src="<?php echo get_post_meta($post->ID, "video", true); ?>" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
				</div>
				
				<?php
					}
					elseif ( has_post_format( 'gallery' ))
					{
				?>
				
				<div class="media">
					<?php $attachments = new Attachments( 'my_attachments' ); ?>
					<?php if( $attachments->exist() ) : ?>
					<div class="slide">
						<?php while( $attachments->get() ) : ?>	
						<div>
							<a href="<?php echo $attachments->url(); ?>" class="lightbox">
								<?php echo $attachments->image( 'port_large' ); ?>
							</a>
						</div>
						<?php endwhile; ?>
					</div>
					<?php endif; ?>
				</div>
				
				<?php 
					}
					else
					{
				?>
				
				<?php } ?>
			</div>
			
			<div class="col-md-4">
				<div class="work-info">
					<h2><?php echo get_the_title();?></h2>
					<p><?php the_content(); ?></p>
					<h4><?php _e( 'Details', 'krwn' ); ?></h4>
					<ul class="details">
						<li><?php _e( 'Company', 'krwn' ); ?>: <?php echo esc_attr($company); ?></li>
						<li><?php _e( 'Budget', 'krwn' ); ?>: <?php echo esc_attr($budget); ?></li>
						<li><?php _e( 'Website', 'krwn' ); ?>: <?php echo esc_attr($website); ?></li>
					</ul>
				</div>
			</div>
			<?php endwhile; ?>	
		</div>
	</div>
</section>
<!-- #work-single -->

<!-- #related-works -->
<?php 
 
// get the custom post type's taxonomy terms
 
$custom_taxterms = wp_get_object_terms( $post->ID, 'portfolio_cat', array('fields' => 'ids') );
// arguments
$args = array(
'post_type' => 'portfolio',
'post_status' => 'publish',
'posts_per_page' => 4, // you may edit this number
'orderby' => 'rand',
'tax_query' => array(
    array(
        'taxonomy' => 'portfolio',
        'field' => 'id',
        'terms' => $custom_taxterms
    )
),
'post__not_in' => array ($post->ID),
);
$related_items = new WP_Query( $args );
// loop over query
if ($related_items->have_posts()) :
while ( $related_items->have_posts() ) : $related_items->the_post();
$ida = get_post_thumbnail_id( get_the_ID(),'port_thumb' );
if(has_post_thumbnail( get_the_ID() ))
{
	$port_large = get_the_post_thumbnail(get_the_ID(), 'port_thumb');
}
else
{
	$port_large = '<img src="http://placehold.it/315x315" alt="Portfolio Image"/>';
}
$terms = get_the_terms(get_the_ID(), 'portfolio_cat');
if(is_array($terms))
{
	foreach ( $terms as $term ) 
	{
			$id = $term->term_id;
			$name = $term->name;
	}
}
$termsn = wp_get_post_terms( get_the_ID(), 'portfolio_cat');
$te = '';
foreach($termsn as $termn)
{
	$te .= '<p>'.esc_attr($termn->name).'</p>';
}
?>
    <li><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
<?php
endwhile;
endif;
// Reset Post Data
wp_reset_postdata();
?>
<section id="related-works" class="section portfolio">
	<div class="container">
		<header class="header-section">
			<h2>Related projects<span class="color">.</span></h2>
		</header>
		<!-- #work-wrap -->
		<div id="work-wrap" class="style-4">
			<?php 
			// get the custom post type's taxonomy terms
			$custom_taxterms = wp_get_object_terms( $post->ID, 'portfolio_cat', array('fields' => 'ids') );
			// arguments
			$args = array(
			'post_type' => 'portfolio',
			'post_status' => 'publish',
			'posts_per_page' => 4, // you may edit this number
			'orderby' => 'rand',
			'tax_query' => array(
				array(
					'taxonomy' => 'portfolio_cat',
					'field' => 'id',
					'terms' => $custom_taxterms
				)
			),
			'post__not_in' => array ($post->ID),
			);
			$related_items = new WP_Query( $args );
			// loop over query
			if ($related_items->have_posts()) :
			while ( $related_items->have_posts() ) : $related_items->the_post();
			$ida = get_post_thumbnail_id( get_the_ID(),'port_thumb' );
			if(has_post_thumbnail( get_the_ID() ))
			{
				$port_large = get_the_post_thumbnail(get_the_ID(), 'port_thumb');
			}
			else
			{
				$port_large = '<img src="http://placehold.it/315x315" alt="Portfolio Image"/>';
			}
			$terms = get_the_terms(get_the_ID(), 'portfolio_cat');
			if(is_array($terms))
			{
				foreach ( $terms as $term ) 
				{
						$id = $term->term_id;
						$name = $term->name;
				}
			}
			$termsn = wp_get_post_terms( get_the_ID(), 'portfolio_cat');
			$te = '';
			foreach($termsn as $termn)
			{
				$te .= '<p>'.esc_attr($termn->name).'</p>';
			}
			?>
			<!-- #work-item -->
			<div class="work-item">
				<div class="work-image">
					<?php
						if(has_post_thumbnail( get_the_ID() ))
					{
					?>
						<img src="<?php echo wp_get_attachment_url($ida); ?>" alt="Portfolio Image"/>
					<?php
					}
					else
					{
					?>
						<img src="http://placehold.it/315x315" alt="Portfolio Image"/>
					<?php } ?>
				</div>
				<a href="<?php echo get_the_permalink(); ?>">
					<div class="caption">
						<div class="tb">
							<div class="tb-cell">
								<h2><?php echo get_the_title(); ?></h2>
								<?php echo $te; ?>
							</div>
						</div>
					</div>
				</a>
			</div>
			<!-- / #work-item -->
			<?php
			endwhile;
			endif;
			// Reset Post Data
			wp_reset_postdata();
			?>
		</div>
		<!-- / #work-wrap -->
	</div>
</section>
<!-- / #related-works -->

<div class="white-space-100"></div>
			
			

<?php break; case "2": ?>


<!-- #work-single -->
<section id="work-single" class="work-single section">
	<div class="container">

		<div class="page-title">
			<?php if (function_exists('my_breadcrumbs')) my_breadcrumbs(); ?>
		</div>


		<div class="row">
			<?php
				while ( have_posts() ) : the_post();
				$company = get_post_meta(get_the_ID(), 'company', TRUE);
				$budget = get_post_meta(get_the_ID(), 'budget', TRUE);
				$website = get_post_meta(get_the_ID(), 'website', TRUE);
				$ida = get_post_thumbnail_id( get_the_ID(), 'port_large' );
				if(has_post_thumbnail( get_the_ID() ))
				{
					$port_large = get_the_post_thumbnail(get_the_ID(), 'port_large');
				}
				else
				{
					$port_large = '<img src="http://placehold.it/750x750" alt="Portfolio Image"/>';
				}
			?>
			
			<div class="col-md-4">
				<div class="work-info">
					<h2><?php echo get_the_title();?></h2>
					<p><?php the_content(); ?></p>
					<h4><?php _e( 'Details', 'krwn' ); ?></h4>
					<ul class="details">
						<li><?php _e( 'Company', 'krwn' ); ?>: <?php echo esc_attr($company); ?></li>
						<li><?php _e( 'Budget', 'krwn' ); ?>: <?php echo esc_attr($budget); ?></li>
						<li><?php _e( 'Website', 'krwn' ); ?>: <?php echo esc_attr($website); ?></li>
					</ul>
				</div>
			</div>
			
			<div class="col-md-8">
				<?php
					if ( has_post_format( 'image' ))
					{
				?>
				
				<div class="media">
					<a href="<?php echo wp_get_attachment_url($ida); ?>" class="lightbox">
						<img src="<?php echo wp_get_attachment_url($ida); ?>" alt="" class="img-responsive" />
					</a>
				</div>
				
				<?php
					}
					elseif ( has_post_format( 'video' ))
					{
				?>
				
				<div class="media fit">
					<iframe src="<?php echo get_post_meta($post->ID, "video", true); ?>" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
				</div>
				
				<?php
					}
					elseif ( has_post_format( 'gallery' ))
					{
				?>
				
				<div class="media">
					<?php $attachments = new Attachments( 'my_attachments' ); ?>
					<?php if( $attachments->exist() ) : ?>
					<div class="slide">
						<?php while( $attachments->get() ) : ?>	
						<div>
							<a href="<?php echo $attachments->url(); ?>" class="lightbox">
								<?php echo $attachments->image( 'port_large' ); ?>
							</a>
						</div>
						<?php endwhile; ?>
					</div>
					<?php endif; ?>
				</div>
				
				<?php 
					}
					else
					{
				?>
				
				<?php } ?>
			</div>
			
			<?php endwhile; ?>	
		</div>
	</div>
</section>
<!-- #work-single -->

<!-- #related-works -->
<?php 
 
// get the custom post type's taxonomy terms
 
$custom_taxterms = wp_get_object_terms( $post->ID, 'portfolio_cat', array('fields' => 'ids') );
// arguments
$args = array(
'post_type' => 'portfolio',
'post_status' => 'publish',
'posts_per_page' => 4, // you may edit this number
'orderby' => 'rand',
'tax_query' => array(
    array(
        'taxonomy' => 'portfolio',
        'field' => 'id',
        'terms' => $custom_taxterms
    )
),
'post__not_in' => array ($post->ID),
);
$related_items = new WP_Query( $args );
// loop over query
if ($related_items->have_posts()) :
while ( $related_items->have_posts() ) : $related_items->the_post();
$ida = get_post_thumbnail_id( get_the_ID(),'port_thumb' );
if(has_post_thumbnail( get_the_ID() ))
{
	$port_large = get_the_post_thumbnail(get_the_ID(), 'port_thumb');
}
else
{
	$port_large = '<img src="http://placehold.it/315x315" alt="Portfolio Image"/>';
}
$terms = get_the_terms(get_the_ID(), 'portfolio_cat');
if(is_array($terms))
{
	foreach ( $terms as $term ) 
	{
			$id = $term->term_id;
			$name = $term->name;
	}
}
$termsn = wp_get_post_terms( get_the_ID(), 'portfolio_cat');
$te = '';
foreach($termsn as $termn)
{
	$te .= '<p>'.esc_attr($termn->name).'</p>';
}
?>
    <li><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
<?php
endwhile;
endif;
// Reset Post Data
wp_reset_postdata();
?>
<section id="related-works" class="section portfolio">
	<div class="container">
		<header class="header-section">
			<h2>Related projects<span class="color">.</span></h2>
		</header>
		<!-- #work-wrap -->
		<div id="work-wrap" class="style-4">
			<?php 
			// get the custom post type's taxonomy terms
			$custom_taxterms = wp_get_object_terms( $post->ID, 'portfolio_cat', array('fields' => 'ids') );
			// arguments
			$args = array(
			'post_type' => 'portfolio',
			'post_status' => 'publish',
			'posts_per_page' => 4, // you may edit this number
			'orderby' => 'rand',
			'tax_query' => array(
				array(
					'taxonomy' => 'portfolio_cat',
					'field' => 'id',
					'terms' => $custom_taxterms
				)
			),
			'post__not_in' => array ($post->ID),
			);
			$related_items = new WP_Query( $args );
			// loop over query
			if ($related_items->have_posts()) :
			while ( $related_items->have_posts() ) : $related_items->the_post();
			$ida = get_post_thumbnail_id( get_the_ID(),'port_thumb' );
			if(has_post_thumbnail( get_the_ID() ))
			{
				$port_large = get_the_post_thumbnail(get_the_ID(), 'port_thumb');
			}
			else
			{
				$port_large = '<img src="http://placehold.it/315x315" alt="Portfolio Image"/>';
			}
			$terms = get_the_terms(get_the_ID(), 'portfolio_cat');
			if(is_array($terms))
			{
				foreach ( $terms as $term ) 
				{
						$id = $term->term_id;
						$name = $term->name;
				}
			}
			$termsn = wp_get_post_terms( get_the_ID(), 'portfolio_cat');
			$te = '';
			foreach($termsn as $termn)
			{
				$te .= '<p>'.esc_attr($termn->name).'</p>';
			}
			?>
			<!-- #work-item -->
			<div class="work-item">
				<div class="work-image">
					<?php
						if(has_post_thumbnail( get_the_ID() ))
					{
					?>
						<img src="<?php echo wp_get_attachment_url($ida); ?>" alt="Portfolio Image"/>
					<?php
					}
					else
					{
					?>
						<img src="http://placehold.it/315x315" alt="Portfolio Image"/>
					<?php } ?>
				</div>
				<a href="<?php echo get_the_permalink(); ?>">
					<div class="caption">
						<div class="tb">
							<div class="tb-cell">
								<h2><?php echo get_the_title(); ?></h2>
								<?php echo $te; ?>
							</div>
						</div>
					</div>
				</a>
			</div>
			<!-- / #work-item -->
			<?php
			endwhile;
			endif;
			// Reset Post Data
			wp_reset_postdata();
			?>
		</div>
		<!-- / #work-wrap -->
	</div>
</section>
<!-- / #related-works -->

<div class="white-space-100"></div>
			

<?php break; case "1": ?> 

<!-- #work-single -->
<section id="work-single" class="work-single section">
	<div class="container">

		<div class="page-title">
			<?php if (function_exists('my_breadcrumbs')) my_breadcrumbs(); ?>
		</div>


		<div class="row">
			<?php
				while ( have_posts() ) : the_post();
				$company = get_post_meta(get_the_ID(), 'company', TRUE);
				$budget = get_post_meta(get_the_ID(), 'budget', TRUE);
				$website = get_post_meta(get_the_ID(), 'website', TRUE);
				$ida = get_post_thumbnail_id( get_the_ID(), 'port_large' );
				if(has_post_thumbnail( get_the_ID() ))
				{
					$port_large = get_the_post_thumbnail(get_the_ID(), 'port_large');
				}
				else
				{
					$port_large = '<img src="http://placehold.it/750x750" alt="Portfolio Image"/>';
				}
			?>
			<div class="col-md-12">
				<?php
					if ( has_post_format( 'image' ))
					{
				?>
				
				<div class="media">
					<a href="<?php echo wp_get_attachment_url($ida); ?>" class="lightbox">
						<img src="<?php echo wp_get_attachment_url($ida); ?>" alt="" class="img-responsive" />
					</a>
				</div>
				
				<?php
					}
					elseif ( has_post_format( 'video' ))
					{
				?>
				
				<div class="media fit">
					<iframe src="<?php echo get_post_meta($post->ID, "video", true); ?>" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
				</div>
				
				<?php
					}
					elseif ( has_post_format( 'gallery' ))
					{
				?>
				
				<div class="media">
					<?php $attachments = new Attachments( 'my_attachments' ); ?>
					<?php if( $attachments->exist() ) : ?>
					<div class="slide">
						<?php while( $attachments->get() ) : ?>	
						<div>
							<a href="<?php echo $attachments->url(); ?>" class="lightbox">
								<?php echo $attachments->image( 'port_large' ); ?>
							</a>
						</div>
						<?php endwhile; ?>
					</div>
					<?php endif; ?>
				</div>
				
				<?php 
					}
					else
					{
				?>
				
				<?php } ?>
			</div>
			
			<div class="col-md-12" style="margin-top: 20px;">
				<div class="work-info">
					<h2><?php echo get_the_title();?></h2>
					<p><?php the_content(); ?></p>
					<h4><?php _e( 'Details', 'krwn' ); ?></h4>
					<ul class="details">
						<li><?php _e( 'Company', 'krwn' ); ?>: <?php echo esc_attr($company); ?></li>
						<li><?php _e( 'Budget', 'krwn' ); ?>: <?php echo esc_attr($budget); ?></li>
						<li><?php _e( 'Website', 'krwn' ); ?>: <?php echo esc_attr($website); ?></li>
					</ul>
				</div>
			</div>
			<?php endwhile; ?>	
		</div>
	</div>
</section>
<!-- #work-single -->

<!-- #related-works -->
<?php 
 
// get the custom post type's taxonomy terms
 
$custom_taxterms = wp_get_object_terms( $post->ID, 'portfolio_cat', array('fields' => 'ids') );
// arguments
$args = array(
'post_type' => 'portfolio',
'post_status' => 'publish',
'posts_per_page' => 4, // you may edit this number
'orderby' => 'rand',
'tax_query' => array(
    array(
        'taxonomy' => 'portfolio',
        'field' => 'id',
        'terms' => $custom_taxterms
    )
),
'post__not_in' => array ($post->ID),
);
$related_items = new WP_Query( $args );
// loop over query
if ($related_items->have_posts()) :
while ( $related_items->have_posts() ) : $related_items->the_post();
$ida = get_post_thumbnail_id( get_the_ID(),'port_thumb' );
if(has_post_thumbnail( get_the_ID() ))
{
	$port_large = get_the_post_thumbnail(get_the_ID(), 'port_thumb');
}
else
{
	$port_large = '<img src="http://placehold.it/315x315" alt="Portfolio Image"/>';
}
$terms = get_the_terms(get_the_ID(), 'portfolio_cat');
if(is_array($terms))
{
	foreach ( $terms as $term ) 
	{
			$id = $term->term_id;
			$name = $term->name;
	}
}
$termsn = wp_get_post_terms( get_the_ID(), 'portfolio_cat');
$te = '';
foreach($termsn as $termn)
{
	$te .= '<p>'.esc_attr($termn->name).'</p>';
}
?>
    <li><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
<?php
endwhile;
endif;
// Reset Post Data
wp_reset_postdata();
?>
<section id="related-works" class="section portfolio">
	<div class="container">
		<header class="header-section">
			<h2>Related projects<span class="color">.</span></h2>
		</header>
		<!-- #work-wrap -->
		<div id="work-wrap" class="style-4">
			<?php 
			// get the custom post type's taxonomy terms
			$custom_taxterms = wp_get_object_terms( $post->ID, 'portfolio_cat', array('fields' => 'ids') );
			// arguments
			$args = array(
			'post_type' => 'portfolio',
			'post_status' => 'publish',
			'posts_per_page' => 4, // you may edit this number
			'orderby' => 'rand',
			'tax_query' => array(
				array(
					'taxonomy' => 'portfolio_cat',
					'field' => 'id',
					'terms' => $custom_taxterms
				)
			),
			'post__not_in' => array ($post->ID),
			);
			$related_items = new WP_Query( $args );
			// loop over query
			if ($related_items->have_posts()) :
			while ( $related_items->have_posts() ) : $related_items->the_post();
			$ida = get_post_thumbnail_id( get_the_ID(),'port_thumb' );
			if(has_post_thumbnail( get_the_ID() ))
			{
				$port_large = get_the_post_thumbnail(get_the_ID(), 'port_thumb');
			}
			else
			{
				$port_large = '<img src="http://placehold.it/315x315" alt="Portfolio Image"/>';
			}
			$terms = get_the_terms(get_the_ID(), 'portfolio_cat');
			if(is_array($terms))
			{
				foreach ( $terms as $term ) 
				{
						$id = $term->term_id;
						$name = $term->name;
				}
			}
			$termsn = wp_get_post_terms( get_the_ID(), 'portfolio_cat');
			$te = '';
			foreach($termsn as $termn)
			{
				$te .= '<p>'.esc_attr($termn->name).'</p>';
			}
			?>
			<!-- #work-item -->
			<div class="work-item">
				<div class="work-image">
					<?php
						if(has_post_thumbnail( get_the_ID() ))
					{
					?>
						<img src="<?php echo wp_get_attachment_url($ida); ?>" alt="Portfolio Image"/>
					<?php
					}
					else
					{
					?>
						<img src="http://placehold.it/315x315" alt="Portfolio Image"/>
					<?php } ?>
				</div>
				<a href="<?php echo get_the_permalink(); ?>">
					<div class="caption">
						<div class="tb">
							<div class="tb-cell">
								<h2><?php echo get_the_title(); ?></h2>
								<?php echo $te; ?>
							</div>
						</div>
					</div>
				</a>
			</div>
			<!-- / #work-item -->
			<?php
			endwhile;
			endif;
			// Reset Post Data
			wp_reset_postdata();
			?>
		</div>
		<!-- / #work-wrap -->
	</div>
</section>
<!-- / #related-works -->

<div class="white-space-100"></div>


<?php break; default: ?> 


<!-- #work-single -->
<section id="work-single" class="work-single section">
	<div class="container">

		<div class="page-title">
			<?php if (function_exists('my_breadcrumbs')) my_breadcrumbs(); ?>
		</div>


		<div class="row">
			<?php
				while ( have_posts() ) : the_post();
				$company = get_post_meta(get_the_ID(), 'company', TRUE);
				$budget = get_post_meta(get_the_ID(), 'budget', TRUE);
				$website = get_post_meta(get_the_ID(), 'website', TRUE);
				$ida = get_post_thumbnail_id( get_the_ID(), 'port_large' );
				if(has_post_thumbnail( get_the_ID() ))
				{
					$port_large = get_the_post_thumbnail(get_the_ID(), 'port_large');
				}
				else
				{
					$port_large = '<img src="http://placehold.it/750x750" alt="Portfolio Image"/>';
				}
			?>
			<div class="col-md-8">
				<?php
					if ( has_post_format( 'image' ))
					{
				?>
				
				<div class="media">
					<a href="<?php echo wp_get_attachment_url($ida); ?>" class="lightbox">
						<img src="<?php echo wp_get_attachment_url($ida); ?>" alt="" class="img-responsive" />
					</a>
				</div>
				
				<?php
					}
					elseif ( has_post_format( 'video' ))
					{
				?>
				
				<div class="media fit">
					<iframe src="<?php echo get_post_meta($post->ID, "video", true); ?>" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
				</div>
				
				<?php
					}
					elseif ( has_post_format( 'gallery' ))
					{
				?>
				
				<div class="media">
					<?php $attachments = new Attachments( 'my_attachments' ); ?>
					<?php if( $attachments->exist() ) : ?>
					<div class="slide">
						<?php while( $attachments->get() ) : ?>	
						<div>
							<a href="<?php echo $attachments->url(); ?>" class="lightbox">
								<?php echo $attachments->image( 'port_large' ); ?>
							</a>
						</div>
						<?php endwhile; ?>
					</div>
					<?php endif; ?>
				</div>
				
				<?php 
					}
					else
					{
				?>
				
				<?php } ?>
			</div>
			
			<div class="col-md-4">
				<div class="work-info">
					<h2><?php echo get_the_title();?></h2>
					<p><?php the_content(); ?></p>
					<h4><?php _e( 'Details', 'krwn' ); ?></h4>
					<ul class="details">
						<li><?php _e( 'Company', 'krwn' ); ?>: <?php echo esc_attr($company); ?></li>
						<li><?php _e( 'Budget', 'krwn' ); ?>: <?php echo esc_attr($budget); ?></li>
						<li><?php _e( 'Website', 'krwn' ); ?>: <?php echo esc_attr($website); ?></li>
					</ul>
				</div>
			</div>
			<?php endwhile; ?>	
		</div>
	</div>
</section>
<!-- #work-single -->

<!-- #related-works -->
<?php 
 
// get the custom post type's taxonomy terms
 
$custom_taxterms = wp_get_object_terms( $post->ID, 'portfolio_cat', array('fields' => 'ids') );
// arguments
$args = array(
'post_type' => 'portfolio',
'post_status' => 'publish',
'posts_per_page' => 4, // you may edit this number
'orderby' => 'rand',
'tax_query' => array(
    array(
        'taxonomy' => 'portfolio',
        'field' => 'id',
        'terms' => $custom_taxterms
    )
),
'post__not_in' => array ($post->ID),
);
$related_items = new WP_Query( $args );
// loop over query
if ($related_items->have_posts()) :
while ( $related_items->have_posts() ) : $related_items->the_post();
$ida = get_post_thumbnail_id( get_the_ID(),'port_thumb' );
if(has_post_thumbnail( get_the_ID() ))
{
	$port_large = get_the_post_thumbnail(get_the_ID(), 'port_thumb');
}
else
{
	$port_large = '<img src="http://placehold.it/315x315" alt="Portfolio Image"/>';
}
$terms = get_the_terms(get_the_ID(), 'portfolio_cat');
if(is_array($terms))
{
	foreach ( $terms as $term ) 
	{
			$id = $term->term_id;
			$name = $term->name;
	}
}
$termsn = wp_get_post_terms( get_the_ID(), 'portfolio_cat');
$te = '';
foreach($termsn as $termn)
{
	$te .= '<p>'.esc_attr($termn->name).'</p>';
}
?>
    <li><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
<?php
endwhile;
endif;
// Reset Post Data
wp_reset_postdata();
?>
<section id="related-works" class="section portfolio">
	<div class="container">
		<header class="header-section">
			<h2>Related projects<span class="color">.</span></h2>
		</header>
		<!-- #work-wrap -->
		<div id="work-wrap" class="style-4">
			<?php 
			// get the custom post type's taxonomy terms
			$custom_taxterms = wp_get_object_terms( $post->ID, 'portfolio_cat', array('fields' => 'ids') );
			// arguments
			$args = array(
			'post_type' => 'portfolio',
			'post_status' => 'publish',
			'posts_per_page' => 4, // you may edit this number
			'orderby' => 'rand',
			'tax_query' => array(
				array(
					'taxonomy' => 'portfolio_cat',
					'field' => 'id',
					'terms' => $custom_taxterms
				)
			),
			'post__not_in' => array ($post->ID),
			);
			$related_items = new WP_Query( $args );
			// loop over query
			if ($related_items->have_posts()) :
			while ( $related_items->have_posts() ) : $related_items->the_post();
			$ida = get_post_thumbnail_id( get_the_ID(),'port_thumb' );
			if(has_post_thumbnail( get_the_ID() ))
			{
				$port_large = get_the_post_thumbnail(get_the_ID(), 'port_thumb');
			}
			else
			{
				$port_large = '<img src="http://placehold.it/315x315" alt="Portfolio Image"/>';
			}
			$terms = get_the_terms(get_the_ID(), 'portfolio_cat');
			if(is_array($terms))
			{
				foreach ( $terms as $term ) 
				{
						$id = $term->term_id;
						$name = $term->name;
				}
			}
			$termsn = wp_get_post_terms( get_the_ID(), 'portfolio_cat');
			$te = '';
			foreach($termsn as $termn)
			{
				$te .= '<p>'.esc_attr($termn->name).'</p>';
			}
			?>
			<!-- #work-item -->
			<div class="work-item">
				<div class="work-image">
					<?php
						if(has_post_thumbnail( get_the_ID() ))
					{
					?>
						<img src="<?php echo wp_get_attachment_url($ida); ?>" alt="Portfolio Image"/>
					<?php
					}
					else
					{
					?>
						<img src="http://placehold.it/315x315" alt="Portfolio Image"/>
					<?php } ?>
				</div>
				<a href="<?php echo get_the_permalink(); ?>">
					<div class="caption">
						<div class="tb">
							<div class="tb-cell">
								<h2><?php echo get_the_title(); ?></h2>
								<?php echo $te; ?>
							</div>
						</div>
					</div>
				</a>
			</div>
			<!-- / #work-item -->
			<?php
			endwhile;
			endif;
			// Reset Post Data
			wp_reset_postdata();
			?>
		</div>
		<!-- / #work-wrap -->
	</div>
</section>
<!-- / #related-works -->

<div class="white-space-100"></div>

<?php } ?>
<!-- Single Page Layout Default -->
<?php
get_footer();