<?php
get_header();
?>
<!-- MAIN -->
<section id="main" class="innerpage">
<!-- Content of MAIN -->
<div class="content">
<!-- page wrap -->
<div class="page_wrap">
<?php if (have_posts()) : while (have_posts()) : the_post();
$custom_preview = get_post_meta($post->ID, "custom_preview", true);
$custom_bg = get_post_meta($post->ID, "custom_bg", true);
$custom_bg_repeat = get_post_meta($post->ID, "custom_bg_repeat", true);
$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), false, '' );
?>
<?php
// Custom background
if($custom_bg) { ?>
<style type="text/css">
body{ background: url(<?php echo $custom_bg; ?>) fixed <?php echo $custom_bg_repeat; ?> center top!important;}
</style>
<?php } ?>
<!-- Left part -->
<div class="left_part">
<!-- Article -->
<article class="blog_post" id="post-<?php echo $post->id; ?>">
<?php if($custom_preview){ ?>
<!-- Preview -->
<div class="post_preview">
<?php echo $custom_preview; ?>
</div>
<!-- /Preview -->
<?php } elseif($src !== ""){ ?>
<!-- Preview -->
<div class="post_preview">
<?php $attr = array('class' => "", "alt" => get_the_title()); the_post_thumbnail('page_size',$attr); ?>
</div>
<!-- /Preview -->
<?php } ?>
<!-- Post title Date -->
<div class="title_page">
<div class="padding_20">
<h2 class="gfont"><?php the_title(); ?></h2>
</div>
</div>
<!-- /Post title Date -->
<!-- Post Content -->
<div class="post_content">
<?php the_content(); ?>
</div>
<!-- /Post Content -->
</article>
<!-- /Article -->
</div>
<!-- /Left part -->
<?php endwhile; endif; ?>
<!-- Sidebar -->
<aside id="sidebar">
<?php if(!dynamic_sidebar('Sidebar Pages')) : echo ''; endif; ?>
</aside>
<!-- /Sidebar -->
<br class="clear" />
</div>
<!-- /page wrap -->
</div>
<!-- /Content of MAIN -->
</section>
<!-- /MAIN -->
<?php
get_footer();
?>