<?php 
	$custom  = photofolio_custom();
	$header_style = $custom['header_style'];
	$header_options = get_post_meta($wp_query->post->ID, '_photofolio_header_style', true);
	if($header_options=='vertical'){
		$header_style = 'vertical';
	}
?>
<?php get_header($header_style);?>

			<!-- page-title section -->
			<section class="page-title-section">
				<div class="container">
					
					<?php if (function_exists('photofolio_breadcrumb')) { photofolio_breadcrumb(); }?>
					
				</div>
			</section>
			<!-- End page-title section -->
			<?php 
				$single_layout = get_post_meta($wp_query->post->ID, '_photofolio_single_layout', true);
			 if($single_layout!='' and $single_layout!='standard'){
				get_template_part('/single/'.$single_layout);
			}else{ ?>
			<?php while(have_posts()) : the_post(); ?>
			<!-- blog section -->
			<section class="blog-section standart single-post">
				<div class="container">
					<div class="row">
						<div class="col-md-9">
							<div class="blog-box">

								<div class="blog-post">
								
									<?php if(get_post_format()=='gallery'){ ?>
										 <?php 
										    $gallery = get_post_meta(get_the_ID(), '_photofolio_gallery', true);
										?>
										<?php if(count($gallery)>0 and $gallery!=''){ ?>
										<div class="post-gallery">
											<div class="flexslider">
												<ul class="slides">
													<?php foreach($gallery as $img) {?>
													<li><img src="<?php echo esc_attr($img); ?>" alt="<?php the_title(); ?>" class="img-responsive"/></li>
													<?php } ?>
												</ul>
											</div>
										</div>
										<?php } ?>

										<?php }elseif(get_post_format()=='video'){ ?>
											 <?php 
											    $video = get_post_meta(get_the_ID(), '_photofolio_intro_video', true);
											?><?php if($video!=''){ ?>
											<div class="post-gallery">
												<!-- Vimeo -->
												<?php echo wp_oembed_get(get_post_meta(get_the_ID(), '_photofolio_intro_video', true)); ?>
												<!-- End Vimeo -->
											</div>
											<?php } ?>
											<?php }else{ ?>
											<div class="post-gallery">
												<?php the_post_thumbnail(); ?>
											</div>
										<?php } ?>
									
									<div class="post-content">
										<?php $cats =get_the_category(); ?>
										<span><?php $i=1; foreach($cats as $cat){ if($i>1){echo ' ,';} echo esc_html($cat->name);  $i++;} ?></span>
										<h1><?php the_title(); ?></h1>
										<?php do_action('photofolio_post_meta');?>
										<div <?php post_class('post-detail'); ?>>
										<?php the_content(); ?>
					                      <?php
					                        $defaults = array(
					                          'before'           => '<div id="page-links"><strong>Page: </strong>',
					                          'after'            => '</div>',
					                          'link_before'      => '<span>',
					                          'link_after'       => '</span>',
					                          'next_or_number'   => 'number',
					                          'separator'        => ' ',
					                          'nextpagelink'     => esc_html__( 'Next page','photofolio' ),
					                          'previouspagelink' => esc_html__( 'Previous page','photofolio' ),
					                          'pagelink'         => '%',
					                          'echo'             => 1
					                        );
					                       ?>
					                      <?php wp_link_pages($defaults); ?>
					                      </div>
										<?php photofolio_post_share($id=get_the_ID()); ?>
									</div>
								</div>
								<?php if($custom['blog_author']==true){ ?>
								<div class="autor-post">
									<?php if(get_user_meta(get_the_author_meta('ID'), '_photofolio_avatar' ,true)!=''){ ?>
										<img src="<?php echo get_user_meta(get_the_author_meta('ID'), '_photofolio_avatar' ,true); ?>" />
										<?php }else{ ?>
										<?php 
										   echo get_avatar(get_the_author_meta('user_email'),$size='100',$default='http://0.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=120' );
										?>
										<?php } ?>
									<div class="autor-content">
										<h2><?php echo esc_html(get_the_author_meta('display_name'));?></h2>
										<?php echo esc_html(get_the_author_meta('description'));?> 
									</div>
								</div>
								<?php } ?>
								<?php if('open' == $post->comment_status){ ?>
								<?php comments_template(); ?>
								<?php } ?>
							</div>
						</div>
						<div class="col-md-3">
							<?php get_sidebar(); ?>
						</div>
					</div>
				</div>
			</section>
			<!-- End blog section -->
		<?php endwhile; ?>
			<?php } ?>
<?php get_footer($header_style); ?>