<?php
/**
 * Blog Main File.
 *
 * @package ROONIX
 * @author  ThemeXriver
 * @version 1.0
 */

get_header();
global $wp_query;
$data  = \ROONIX\Includes\Classes\Common::instance()->data( 'blog' )->get();
$layout = $data->get( 'layout' );
$sidebar = $data->get( 'sidebar' );
$layout = ( $layout ) ? $layout : 'right';
$sidebar = ( $sidebar ) ? $sidebar : 'default-sidebar';
if (is_active_sidebar( $sidebar )) {$layout = 'right';} else{$layout = 'full';}
$class = ( !$layout || $layout == 'full' ) ? 'col-xs-12 col-sm-12 col-md-12 col-lg-12' : 'col-lg-8 col-md-12 col-sm-12';
if ( class_exists( '\Elementor\Plugin' ) AND $data->get( 'tpl-type' ) == 'e' AND $data->get( 'tpl-elementor' ) ) {
	echo Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $data->get( 'tpl-elementor' ) );
} else {
?>
	
<?php if ( class_exists( '\Elementor\Plugin' )):?>
	<?php do_action( 'roonix_banner', $data );?>
<?php else:?>

<section class="page-title" style="background-image: url(<?php echo esc_url( $data->get( 'banner' ) ); ?>)">
    <div class="auto-container">
        <h2><?php if( $data->get( 'title' ) ) echo wp_kses( $data->get( 'title' ), true ); else( get_the_title( '' ) ); ?></h2>
    </div>
    <!-- Scroll To Down -->
    <div class="scroll-to-down scroll-to-target" data-target=".services-page-section"><span class="flaticon-down-arrow-1"></span></div>
</section>

<?php endif;?>

<!-- sidebar-page-container -->
<div class="sidebar-page-container">
    <div class="auto-container">
        <div class="row clearfix">
			
			<!--Sidebar Start-->
			<?php
				if ( $data->get( 'layout' ) == 'left' ) {
					do_action( 'roonix_sidebar', $data );
				}
			?>
			<div class="content-side <?php echo esc_attr( $class ); ?>">
				<div class="blog-classic">	
					<div class="thm-unit-test">
						
						<?php
							while ( have_posts() ) :
								the_post();
								roonix_template_load( 'templates/blog/blog.php', compact( 'data' ) );
							endwhile;
							wp_reset_postdata();
						?>
							
					</div>
				
					<!--Pagination-->
					<div class="page-navigation">
						<?php roonix_the_pagination( $wp_query->max_num_pages );?>
					</div>
				</div>
			</div>
			
			<!--Sidebar Start-->
			<?php
				if ( $data->get( 'layout' ) == 'right' ) {
					do_action( 'roonix_sidebar', $data );
				}
			?>
			
		</div>
	</div>
</div>
<!--End blog area--> 
<?php
}
get_footer();
