<?php get_header(); ?>  

<?php 
if(get_post_meta($post->ID, 'pyre_slider_layer', true) != 0) { 
?>  
    <div id="slider-output">
    	<?php echo do_shortcode('[layerslider id="'.get_post_meta($post->ID, 'pyre_slider_layer', true).'"]'); ?>
    </div>
<?php 
}
?>

<div class="content-wrap">

	<div class="container clearfix">

	<?php
	if(get_post_meta($post->ID, 'pyre_en_sidebar', true) != 'no'){
		$class = 'postcontent single_post clearfix';
		
		if(get_post_meta($post->ID, 'pyre_sidebar_pos', true) == 'left' && $data['sidebar_position'] != 'Left') {
			$content_css = 'style="margin-right: 0; float: right; margin-left: 30px;"';
			$sidebar_css = 'style="float: left; clear: left;"';
		}
		elseif(get_post_meta($post->ID, 'pyre_sidebar_pos', true) == 'right' && $data['sidebar_position'] != 'Right') {
			$content_css = 'style="margin-left: 0; float: left; margin-right: 30px;"';
			$sidebar_css = 'style="float: right; clear: right;"';
		}
	}
	else{
		$class = 'col_full';
	}
	?>    
    
    	<div class="<?php echo $class; ?> nobottommargin" <?php echo $content_css; ?>>
         
        <?php				
		if(have_posts()): the_post();
			global $data;	
		?>
			<div id="post-<?php the_ID(); ?>" class="entry post-single clearfix">
				
                <?php if($data['featured_images_single']): ?>
                	<?php if(has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_youtube', true) || get_post_meta(get_the_ID(), 'pyre_vimeo', true)){ ?>
                    <div class="entry_image">                    
                        <div class="fslider" data-animate="<?php echo $data['bp_anim']; ?>" <?php if($data['bp_anim_auto']) echo 'data-slideshow="true"'; if($data['bp_anim_control']) echo 'data-direction-nav="true"'; ?> data-speed="<?php echo $data['bp_anim_speed']; ?>" data-pause="<?php echo ($data['bp_anim_pause_time']*1000); ?>" <?php if($data['bp_anim_pause']) echo 'data-pause-hover="true"'; ?>>
                        
                            <div class="flexslider">
                            
                                <div class="slider-wrap">
                                
                                    <?php 
                                    if(get_post_meta(get_the_ID(), 'pyre_youtube', true)) {
                                        echo '<div class="slide">'.do_shortcode('[youtube id='.get_post_meta(get_the_ID(), 'pyre_youtube', true).']').'</div>';
                                        $icon = 'fa-film';
                                    }
                                    if(get_post_meta(get_the_ID(), 'pyre_vimeo', true)) {
                                         echo '<div class="slide">'.do_shortcode('[vimeo id='.get_post_meta(get_the_ID(), 'pyre_vimeo', true).']').'</div>';
                                         $icon = 'fa-film';
                                    }                                                
                                    if(has_post_thumbnail() && get_post_meta($post->ID, 'pyre_skip_first', true) != 'yes'){	
                                    ?>
                                   
										<?php									
                                        $full_picture = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');				
                                        ?>
                                        
                                        <div class="slide">
                                            <a href="<?php echo $full_picture[0]; ?>" rel="prettyPhoto[gallery]">
                                                <img src="<?php echo $full_picture[0]; ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />
                                                <div class="portfolio-overlay"></div>
                                            </a>                                    
                                        </div>
                                        
                                    <?php
                                    }
                                    
                                    $i = 2;
                                    while($i <= $data['featured_images']):
										$attachment = new StdClass;
                                        $attachment->ID = kd_mfi_get_featured_image_id('featured-image-'.$i, 'post');
                                        if($attachment->ID):
                                        $icon='fa-picture-o';
                                            ?>
                                            
                                            <?php 											
											$full_picture = wp_get_attachment_image_src( $attachment->ID, 'full' );						
											
											?>
                                            
                                            <div class="slide">	
                                                <a href="<?php echo $full_picture[0] ?>" rel="prettyPhoto[gallery]">
                                                	<img src="<?php echo $full_picture[0]; ?>" alt="<?php echo $attachment->post_title; ?>" />
                                                    <div class="portfolio-overlay"></div>
                                                </a>
                                                
                                            </div>                                                        
                                            <?php 
                                        endif; 
                                        $i++; 
                                    endwhile; ?>
                                                                
                                </div>
                            
                            </div>
                        
                        </div>
                    
                    </div>
				<?php
					}
				endif;
				 
				if($data['blog_post_title']):
					if(get_post_meta($post->ID, 'pyre_show_title', true) == 'yes'):
				?>
                   		<div class="entry_title"><h2><?php the_title(); ?></h2></div>   
                <?php 
					endif;
				endif;
					
				if($data['post_meta_date'] || $data['post_meta_author'] || $data['post_meta_cats'] || $data['post_meta_comments']):
					?>             
                    <ul class="entry_meta clearfix">
                    	<?php
						if($data['post_meta_date']):
						?> 
                    		<li><i class="fa-calendar"></i><?php the_time( get_option('date_format') ); ?><span></span></li>                 
                        <?php
						endif;
						
						?>                    
                    </ul>
                 <?php
				endif;
				?>
                    
                <div class="entry_content">
                	<?php the_content(); ?>
                        
					<?php
					if($data['post_meta_tags']):
					?>
                    	<div class="tagcloud clearfix">
                        	<?php the_tags('',''); ?>                       
                        </div>
                    <?php
					endif;
					?>
                        
                    <?php
					if($data['social_sharing_box']):
					
						if($data['social_icons_shape']=='Round'){
							$shape = 'round';
						}
						else{
							$shape = 'square';
						}
					?>
                    	<div class="entry_share clearfix">
                                    
                                <span><?php echo __('PARTILHAR:','Nimva'); ?></span>
                                                
                                <a href="http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>&amp;t=<?php the_title(); ?>" class="ntip" title="Partilhar no Facebook"><img src="<?php bloginfo( 'template_url' ); ?>/images/icons/social/post/facebook-<?php echo $shape; ?>.png" alt="Facebook" /></a>
                                
                                <a href="http://twitter.com/home?status=<?php the_title(); ?> <?php the_permalink(); ?>" class="ntip" title="Partilhar no Twitter"><img src="<?php bloginfo( 'template_url' ); ?>/images/icons/social/post/twitter-<?php echo $shape; ?>.png" alt="Twitter" /></a>
                                
                                <?php $full_image_share = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); ?>
                                <a href="http://pinterest.com/pin/create/button/?url=<?php echo urlencode(get_permalink()); ?>&amp;description=<?php echo urlencode($post->post_title); ?>&amp;media=<?php echo urlencode($full_image_share[0]); ?>" class="ntip" title="Partilhar no Pinterest"><img src="<?php bloginfo( 'template_url' ); ?>/images/icons/social/post/pinterest-<?php echo $shape; ?>.png" alt="Pinterest" /></a>
                                
                                <a href="https://plus.google.com/share?url=<?php the_permalink(); ?>" onclick="javascript:window.open(this.href,
  '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;" class="ntip" title="Partilhar no Google Plus"><img src="<?php bloginfo( 'template_url' ); ?>/images/icons/social/post/googleplus-<?php echo $shape; ?>.png" alt="Google Plus" /></a>
  
                            
                                
                                <a href="mailto:?subject=<?php the_title(); ?>&amp;body=<?php the_permalink(); ?>" class="ntip" title="Partilhar por Email"><img src="<?php bloginfo( 'template_url' ); ?>/images/icons/social/post/email-<?php echo $shape; ?>.png" alt="Email" /></a>
                                            
                            </div>
                    <?php
					endif;
					?>
                       
                    </div>

                
                
                
            </div>
            
            <div class="clear"></div>
            
           
            
			                        
            <div class="clear"></div>  
            
           

        <?php
		endif;
		?>    
        	  
        </div>
        <?php
		if(get_post_meta($post->ID, 'pyre_en_sidebar', true) != 'no'){
		?>
        	<div class="sidebar col_last nobottommargin clearfix" <?php echo $sidebar_css; ?>>
            	<div class="sidebar-widgets-wrap clearfix">
					<?php
                    if ( !function_exists( 'generated_dynamic_sidebar' ) || !generated_dynamic_sidebar() ): 
                    endif;
					?> 
                </div>
            </div>
        <?php
		}
		?>
    </div>

</div>
	
	
<?php get_footer(); ?>