<?php

$meta = _WSH()->get_meta('_sh_layout_settings');
$meta1 = _WSH()->get_meta('_sh_header_settings');

$bg = sh_set( $meta, 'bg_image' );
$bg = ( $bg ) ? $bg : get_template_directory_uri().'/images/other/parallax.jpg';

$layout = sh_set( $meta, 'layout', 'right' );
$sidebar = sh_set( $meta, 'sidebar', 'default-sidebar' );

$classes = ( !$layout || $layout == 'full' ) ? ' col-lg-12 col-md-12' : ' col-lg-9 col-md-9';

if(!sh_set($_GET, 'ajax')) :

    get_header(); 

    /** Update the post views counter */
    //_WSH()->post_views( true );
    ?>


    <div class="page-header parallax" style="background-image: url(<?php echo esc_url($bg); ?>);"></div>

    <?php get_template_part('includes/modules/nav'); 

endif; ?>


<!-- === START POST SECTION === -->
        <section class="section padding" id="blog">
            <div class="container">
                <div class="row">
                    
                    <?php if( $layout == 'left' ): ?>
                        <div class="col-md-3">
                            <div class="sidebar">
                                <?php dynamic_sidebar( $sidebar ); ?>
                            </div>
                        </div>
                    <?php endif; ?>
                    
                    <div class="<?php echo esc_attr($classes); ?>">
                                                
                        <?php while( have_posts() ): the_post(); ?>
                
                            <?php get_template_part( 'blog', get_post_format() ); ?>
                            <?php //wp_link_pages(); ?>

                        <?php endwhile; ?>
                        

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

                    
                    <?php if( $layout == 'right' ): ?>  
                        <div class="col-md-3">
                            <div class="sidebar">
                                <?php dynamic_sidebar( $sidebar ); ?>
                            </div>
                        </div>
                    <?php endif; ?>
                    
                </div>
            </div>
        </section>
<!-- === END POST SECTION === -->

<?php if(!sh_set($_GET, 'ajax'))
get_footer(); ?>