<?php $bauen_options = get_option('bauen'); ?>

	<section class="bauen-blog3 section-padding2">
		<div class="container">
			<div class="row">
				<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
				<?php global $bauen_sidebar_class; ?>
				<?php $bauen_sidebar_class = "col-md-8";?>
				<?php else : ?>
				<?php $bauen_sidebar_class = "col-md-10 offset-1";?>
				<?php endif;?>
				<div class="<?php echo esc_attr($bauen_sidebar_class);?>">					
					<div class="row">					
						<?php global $post, $post_id, $bauen_post_title;?>
					    <?php while ( have_posts() ) : the_post();?>   					
					   
					    <div class="col-md-12"> 
					    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>						
                            <div class="item">
							    <?php if (has_post_thumbnail( $post->ID ) ):?> 
							    <?php $bauen_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), '' );?>
							    <?php $bauen_image_id = get_post($id); $bauen_image_title = $bauen_image_id->post_title; ?>
                                <div class="post-img">
                                    <a href="<?php the_permalink();?>"> <img src="<?php echo esc_url($bauen_image[0]);?>" alt="<?php echo esc_attr($bauen_image_title);?>" /> </a>
                                </div>
								<?php endif;?>								
                                <div class="post-cont"> 
                                   	<span class="tag"><?php the_category(', ');?></span> <i><?php esc_html_e('|','bauen');?></i> <span class="date"><?php the_time( get_option( 'date_format' ) ); ?></span>
									<?php $bauen_post_title= get_the_title(); ?>
									<h5><a href="<?php the_permalink();?>">
										<?php if($bauen_post_title != '') { ?>
											<?php the_title();?>
										<?php } else { ?>	
											<?php the_time( get_option( 'date_format' ) ); ?>
										<?php } ?>											
									</a></h5> 									
                                    
                                    <!-- excerpt -->
									<?php if( wp_link_pages('echo=0') ): ?>
										<?php the_content(
											sprintf(
											/* translators: %s: Post title. */
											esc_html__( '', 'bauen' ),
												get_the_title()
												)
											);
											wp_link_pages( array(
												'before'      => '<div class="page-links">',
												'after'       => '</div>',
												'link_before' => '<span>',
												'link_after'  => '</span>',
												'pagelink'    => '%',
												'separator'   => '',
											) );
											?>
									<?php else : ?>
										<?php the_excerpt();?>
									<?php endif;?>	
                                </div>
                            </div>						
                        </div>						
                        </div>		
						<?php endwhile; ?>
						<?php wp_reset_postdata();?>						
                    </div>
					<div class="hidden"><?php the_tags(); next_posts_link(); previous_posts_link();wp_link_pages();comment_form();paginate_comments_links();previous_comments_link(); wp_enqueue_script('comment-reply'); the_post_thumbnail();?></div>	
					<!-- pagination start -->
					<?php if (function_exists("bauen_pagination")) {
					bauen_pagination($wp_query->max_num_pages);
					} ?>
					<!-- pagination end -->						
                </div>	
			
				<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
	            <div class="col-md-4">
                    <div class="blog-sidebar">	
                        <?php dynamic_sidebar( 'sidebar-1' ); ?>
                    </div>						
                </div>					
                <?php endif;?>
			</div>	
	    </div>
    </section>		
    <!-- section end -->	