<?php
/**
 * Template Name: Product
 *
 * Template for displaying a page without sidebar even if a sidebar widget is published.
 *
 * @package BBase_Code
 */


defined( 'ABSPATH' ) || exit;

get_header(); the_post(); ?>

<div class="banner">
    <div class="container">
        <img src="<?php the_post_thumbnail_url( 'full' ) ?>" alt="<?php the_title() ?>">
    </div>
</div>

<?php
if ( function_exists('yoast_breadcrumb') ) {
    yoast_breadcrumb( '<div class="container" id="breadcrumbs">','</div>' );
}
?>

<div class="wrap-product">
    <div class="container">
        <div class="row">
            <div class="col-md-3 s-sidebar">
                <?php get_sidebar( 'product' ) ?>
            </div>

            <div class="col-md-9">
                <?php product_filter() ?>

                <div class="product-list">
                <?php 
                    $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;

                    $args = array(
                        'post_type'              => array( 'product' ),
                        'paged'                  => $paged,
                        'posts_per_page'         => '16',
                    );

                    $wp_query = new WP_Query( $args );
                    if ( $wp_query->have_posts() ) {
                        while ( $wp_query->have_posts() ) { $wp_query->the_post();
                            get_template_part( 'template-parts/content', 'product' );
                        }
                    }                   
                ?>
                </div>
                <?php bbase_code_pagination(); 
                    wp_reset_postdata();?>
            </div>

        </div>
    </div>
</div>

<?php get_footer() ?>