<?php
/**
* The Template for displaying all single products
*
* This template can be overridden by copying it to cyarb/woocommerce/single-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 1.6.4
*/
global $cyarb_opt;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
get_header( 'shop' );
if( function_exists('acf_add_options_page') ) {
$hide_banner = get_field( 'enable_page_banner' );
$hide_breadcrumb = get_field( 'hide_breadcrumb' );
$banner_title = get_field( 'page_banner_title' );
$bg_img = get_field( 'banner_background_image' );
} else {
$hide_banner = false;
$hide_breadcrumb = false;
$banner_title = '';
$bg_img = '';
}
// 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;
$product_sidebar = isset( $cyarb_opt['product_sidebar']) ? $cyarb_opt['product_sidebar'] : '';
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );
?>
<?php if( $hide_banner == false ) { ?>
<div class="page-title-area" style="background-image:url(<?php echo esc_url( $bg_img ); ?>);">
<div class="container">
<div class="page-title-content">
<?php if ( $banner_title ): ?>
<h1><?php echo esc_html($banner_title); ?></h1>
<?php else: ?>
<h1><?php the_title(); ?></h1>
<?php endif;?>
<?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 the_title(); ?></li>
</ul><?php
endif; ?>
</div>
</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="products_details ptb-100 <?php echo esc_attr( $page_spac ); ?>">
<div class="container">
<div class="row">
<?php if ( is_active_sidebar( 'shop' ) ): ?>
<?php if ( isset( $_GET['shop'] ) ): ?>
<?php $cyarb_shop_cat_sidebar = $_GET['shop']; ?>
<?php 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; ?>
<?php else: ?>
<?php 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 else: ?>
<div class="col-lg-12 col-md-12">
<?php endif; ?>
<?php endif; ?>
<?php else: ?>
<div class="col-lg-12 col-md-12">
<?php endif; ?>
<?php
/**
* woocommerce_before_main_content hook.
*
* @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
* @hooked woocommerce_breadcrumb - 20
*/
do_action( 'woocommerce_before_main_content' );
while ( have_posts() ) : the_post();
wc_get_template_part( 'content', 'single-product' );
endwhile;
/**
* woocommerce_after_main_content hook.
*
* @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
*/
do_action( 'woocommerce_after_main_content' );
?>
</div>
<?php
if ( isset( $_GET['shop'] ) ):
if ( $cyarb_shop_cat_sidebar == 'right' ) :
do_action( 'woocommerce_sidebar' );
endif;
else:
if ( $product_sidebar == 'right-sidebar' ):
do_action( 'woocommerce_sidebar' );
endif;
endif;
?>
</div>
</div>
</div>
<?php get_footer( 'shop' );
/* Omit closing PHP tag at the end of PHP files to avoid "headers already sent" issues. */
?>