<?php
/**
 * The main template file for display single post page.
 *
 * @package WordPress
*/

//If portfolio or gallery content then go to another template
if($post->post_type == 'portfolios')
{
	get_template_part("portfolio_single");
    exit;
}
elseif($post->post_type == 'gallery')
{
	get_template_part("gallery");
    exit;
}

get_header(); 

$page = get_page($post->ID);
$current_page_id = $page->ID;
$page_sidebar = 'Blog Sidebar';

?>
		
	</div>
	
	<div class="page_caption">
		<div class="caption_inner">
			<div class="caption_header">
				<h1><span><?php echo _e( 'Blog Post', THEMEDOMAIN ); ?></span></h1>
			</div>
		</div>
		
		<hr class="hr_page_caption"/>
	</div>
	<br class="clear"/>
	
	<!-- Begin content -->
	<div id="content_wrapper">
	    
	    <div class="inner">
	    
	    	<!-- Begin main content -->
	    	<div class="inner_wrapper">
	    	
	    		<div class="standard_wrapper">
	    		
	    			<?php
					if (have_posts()) : while (have_posts()) : the_post();
					?>
	    		
	    			<div class="sidebar_content">
						
						<?php
							$image_thumb = '';
							$pp_blog_single_img = get_option('pp_blog_single_img');
														
							if(!empty($pp_blog_single_img) && has_post_thumbnail(get_the_ID(), 'blog'))
							{
							    $image_id = get_post_thumbnail_id(get_the_ID());
							    $image_thumb = wp_get_attachment_image_src($image_id, 'blog', true);
							}
						?>
						
						<!-- Begin each blog post -->
						<div id="post-<?php the_ID(); ?>" <?php post_class(); ?> class="post_wrapper">
						
							<span class="post_color_date"><?php echo get_the_time('F d, Y'); ?></span>
					
							<h3 class="post_heading">
								<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
						    </h3>
						
							<?php
						        if(isset($image_thumb[0]))
						        {
						    ?>	
						    	<div class="post_img_wrapper">
						    		<img src="<?php echo $image_thumb[0]; ?>" alt=""/>
							    </div>
						    
						    <?php
						    	}
						    ?>
						    
						    <br class="clear"/>
						    
						    <div class="post_header_wrapper">
						    	<div class="post_header">
						    		<div class="post_detail">
						    			<div class="post_detail_item">
											<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/post_icon_user.png" alt="" class="middle"/>
											<?php echo get_the_author(); ?>
								    	</div>
								    	<div class="post_detail_item">
								    		<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/post_icon_comment.png" alt="" class="middle"/>
											<a href="<?php the_permalink(); ?>"><?php comments_number(__( 'Leave a Comment', THEMEDOMAIN ), __( 'Comment: 1', THEMEDOMAIN ), __( 'Comment: %', THEMEDOMAIN )); ?></a>
								    	</div>
								    	<div class="post_detail_item">
								    		<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/post_icon_tags.png" alt="" class="middle"/>
											<?php the_tags(); ?>
								    	</div>
									</div>
						    	</div>
						    </div>
						    
						    <div class="post_excerpt">
						    <?php
						    	the_content();
							?>
							    
						    </div>
						    
						    <br class="clear"/>
						    
						    <div class="tag_cloud">
						    	<?php the_tags('', ''); ?>
						    </div>
						    
						    <?php
						    $pp_blog_share = get_option('pp_blog_share');
						    	
						    	if(!empty($pp_blog_share))
						    	{
						    ?>	
						    
						    	<br class="clear"/><div class="thickline"></div><br class="clear"/>
						    
							    <!-- AddThis Button BEGIN -->
								<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
								<a class="addthis_button_preferred_1"></a>
								<a class="addthis_button_preferred_2"></a>
								<a class="addthis_button_preferred_3"></a>
								<a class="addthis_button_preferred_4"></a>
								<a class="addthis_button_compact"></a>
								<a class="addthis_counter addthis_bubble_style"></a>
								</div>
								<script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>
								<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ppulpipatnan"></script>
								<!-- AddThis Button END -->
							    <br class="clear"/>
							    
							<?php
								}
							?>
								
						
						</div>
						
						<!-- End each blog post -->
						
						
						<?php comments_template( '' ); ?>
						
						<?php wp_link_pages(); ?>
						
						<?php endwhile; endif; ?>

					</div>
					
					<div class="sidebar_wrapper">
						<div class="sidebar_top" style="border:0"></div>
					
						<div class="sidebar">
							
							<div class="content">
							
								<ul class="sidebar_widget">
									<?php dynamic_sidebar($page_sidebar); ?>
								</ul>
								
							</div>
						
						</div>
						
						<div class="sidebar_bottom"></div>
						<br class="clear"/>
					
					</div>
					
				</div>
				<!-- End main content -->
				
				<br class="clear"/>
			</div>
		</div>
				

<?php get_footer(); ?>