File "archive-product.php"

Full Path: /home/flipjqml/onlinebetsolution.com/wp-content/themes/cyarb/woocommerce/archive-product.php
File size: 7.32 KB
MIME-type: text/x-php
Charset: utf-8

<?php
/**
 * The Template for displaying product archives, including the main shop page which is a post type archive
 *
 * This template can be overridden by copying it to cyarb/woocommerce/archive-product.php.
 *
 * HOWEVER, on occasion WooCommerce will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see https://docs.woocommerce.com/document/template-structure/
 * @package WooCommerce/Templates
 * @version 3.4.0
 */

defined( 'ABSPATH' ) || exit;

get_header( 'shop' );

global $cyarb_opt;

/**
 * Hook: woocommerce_before_main_content.
 *
 * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
 * @hooked woocommerce_breadcrumb - 20
 * @hooked WC_Structured_Data::generate_website_data() - 30
 */
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );

do_action( 'woocommerce_before_main_content' );

$post_page_id       = get_option( 'woocommerce_shop_page_id' );
$product_sidebar    = isset( $cyarb_opt['product_sidebar']) ? $cyarb_opt['product_sidebar'] : '';

if( function_exists('acf_add_options_page') ) {
	$hide_banner 		= get_field( 'enable_page_banner', $post_page_id);
	$hide_breadcrumb 	= get_field( 'hide_breadcrumb' , $post_page_id);
	$banner_title 	    = get_field( 'page_banner_title' , $post_page_id);
}else {
	$hide_banner 		= false;
	$hide_breadcrumb 	= false;
	$banner_title 	    = '';
}

// After Hiding Banner add spacing
if( $hide_banner == true){
    $page_spac = 'mt-80';
} else {
    $page_spac = '';
}

// page banner shape image
if( isset( $cyarb_opt['cyarb_banner_image_shape'] ) ):	
	$banner_shape = $cyarb_opt['cyarb_banner_image_shape'];
else:
	$banner_shape = '';
endif;

$post_page_id       = get_option( 'woocommerce_shop_page_id' );
?> 

<?php if( $hide_banner == false ) { ?>
	<div class="page-title-area" style="background-image:url(<?php echo esc_url( get_the_post_thumbnail_url($post_page_id) ); ?>);">
		<div class="container">
            <?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
			<div class="page-title-content">
                <?php if( $banner_title ) { ?>
                    <h1><?php echo esc_html($banner_title); ?></h1>
                <?php } else { ?>
                    <h1> <?php woocommerce_page_title(); ?> </h1>
                <?php } ?>

				<?php if( $hide_breadcrumb == false ) : ?>
					<ul>
						<li>
							<a href="<?php echo esc_url( home_url( '/' ) ); ?>">
								<?php esc_html_e('Home', 'cyarb')?>
							</a>
						</li>
						<li><?php woocommerce_page_title(); ?></li>
					</ul><?php
				endif; ?>
			</div>
            <?php endif; ?>
		</div>
		<?php if( $banner_shape == 1 ) : ?>
			<div class="shape1"><img src="<?php echo esc_url(get_template_directory_uri() .'/assets/img/shape/shape1.png' ); ?>" alt="<?php the_title_attribute(); ?>"></div>
			<div class="shape2"><img src="<?php echo esc_url(get_template_directory_uri() .'/assets/img/shape/shape2.png' ); ?>" alt="<?php the_title_attribute(); ?>"></div>
			<div class="shape4"><img src="<?php echo esc_url(get_template_directory_uri() .'/assets/img/shape/shape4.png' ); ?>" alt="<?php the_title_attribute(); ?>"></div>
			<div class="shape5"><img src="<?php echo esc_url(get_template_directory_uri() .'/assets/img/shape/shape5.png' ); ?>" alt="<?php the_title_attribute(); ?>"></div>
		<?php endif; ?>
	</div>
<?php } ?>
  
<div class="special-products-area pt-100 pb-100 <?php echo esc_attr( $page_spac ); ?>">
    <div class="container">
        <div class="row">
        <?php
            if ( is_active_sidebar( 'shop' ) ) {
                if ( isset( $_GET['shop'] ) ) {
                    $cyarb_shop_cat_sidebar = $_GET['shop'];

                    if ( $cyarb_shop_cat_sidebar == 'none' ): ?>
                        <div class="col-lg-12 col-md-12">
                    <?php elseif ( $cyarb_shop_cat_sidebar == 'left' ): ?>
                        <?php do_action( 'woocommerce_sidebar' ); ?>
                        <div class="col-lg-8 col-md-12">
                    <?php elseif ( $cyarb_shop_cat_sidebar == 'right' ): ?>
                        <div class="col-lg-8 col-md-12">
                    <?php endif;

                } else {
                    if( $product_sidebar == 'left-sidebar' ): ?>
                        <?php do_action( 'woocommerce_sidebar' ); ?>
                        <div class="col-lg-8 col-md-12">
                    <?php elseif ( $product_sidebar == 'right-sidebar' ): ?>
                        <div class="col-lg-8 col-md-12">
                    <?php elseif ( $product_sidebar == 'cyarb_product_no_sidebar' ): ?>
                        <div class="col-lg-12 col-md-12">
                    <?php else: ?>
                        <?php do_action( 'woocommerce_sidebar' ); ?>
                        <div class="col-lg-8 col-md-12">
                    <?php endif;
                }
            } else { ?>
                <div class="col-lg-12 col-md-12">
            <?php } ?>
                <?php if ( woocommerce_product_loop() ) { ?>

                    <div class="woocommerce-topbar">
                        <?php do_action( 'woocommerce_before_shop_loop' ); ?>
                    </div>

                    <?Php
                    woocommerce_product_loop_start();

                    if ( wc_get_loop_prop( 'total' ) ) {
                        while ( have_posts() ) {
                            the_post();

                            /**
                             * Hook: woocommerce_shop_loop.
                             *
                             * @hooked WC_Structured_Data::generate_product_data() - 10
                             */
                            do_action( 'woocommerce_shop_loop' );

                            wc_get_template_part( 'content', 'product' );
                        }
                    }

                    woocommerce_product_loop_end();

                    /**
                     * Hook: woocommerce_after_shop_loop.
                     *
                     * @hooked woocommerce_pagination - 10
                     */
                    do_action( 'woocommerce_after_shop_loop' );
                } else {
                    /**
                     * Hook: woocommerce_no_products_found.
                     *
                     * @hooked wc_no_products_found - 10
                     */
                    do_action( 'woocommerce_no_products_found' );
                } ?>
            </div> <!-- end clo-8 -->
            
            <?php 
            if ( isset( $_GET['shop'] ) ) {
                if ( $cyarb_shop_cat_sidebar == 'right' ) { 
                    do_action( 'woocommerce_sidebar' );
                }
            } else {
                if ( $product_sidebar == 'right-sidebar' ) { 
                    do_action( 'woocommerce_sidebar' );
                }
            } ?>
        </div>
    </div>
</div>
<?php
/**
 * Hook: woocommerce_after_main_content.
 *
 * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
 */
do_action( 'woocommerce_after_main_content' );

/**
 * Hook: woocommerce_sidebar.
 *
 * @hooked woocommerce_get_sidebar - 10
 */

get_footer( 'shop' ); ?>