<?php
/**
 * Template Name: Product Page Template
 *
 * @package power
 */

get_header();
?>

<div id="primary" class="content-area">
    <main id="main" class="site-main">
        <div class="product-category">
		    <?php
		    if ( have_posts() ) :

			    /* Start the Loop */
			    if ( have_posts() ) :
				    the_post();

				    get_template_part( 'template-parts/content', get_post_type() );

			    endif;

		    endif;
		    ?>

        </div>


        <div class="product-list">
            <div class="breadcrumb">
		        <?php
		        echo do_shortcode( '[flexy_breadcrumb]' );
		        ?>
            </div><!-- #breadcrumb -->
			<?php
			query_posts([
				'post_type'=>'product',
				'post_status' => 'publish',
				'orderby' => 'id',
				'order' => 'ASC',
				'posts_per_page'=>'20',
				'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1),


			]);

			while ( have_posts() ) : the_post(); ?>

				<?php get_template_part( 'template-parts/content', 'product' );?>
			<?php endwhile; ?>


            <div class="pagination">
	            <?php echo paginate_links( $args ); ?>
	            <?php $args = array(
		            'base'               => '%_%',
		            'format'             => '?paged=%#%',
		            'total'              => 1,
		            'current'            => 0,
		            'show_all'           => false,
		            'end_size'           => 1,
		            'mid_size'           => 2,
		            'prev_next'          => true,
		            'prev_text'          => __('« Previous'),
		            'next_text'          => __('Next »'),
		            'type'               => 'plain',
		            'add_args'           => false,
		            'add_fragment'       => '',
		            'before_page_number' => '',
		            'after_page_number'  => ''
	            ); ?>
            </div>

        </div>


    </main><!-- #main -->

</div><!-- #primary -->

<?php
get_sidebar();
get_footer();
?>