| Server IP : 213.186.33.4 / Your IP : 216.73.216.222 Web Server : Apache System : Linux webm005.cluster103.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64 User : karinebmkh ( 644538) PHP Version : 8.4.22 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/karinebmkh/www2/wp-content/themes/glaza/includes/ |
Upload File : |
<?php
//remove
remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 );
remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
remove_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating' );
add_action( 'woocommerce_before_shop_loop_item_title', 'glaza_buttons_wrapper_open', 15 );
add_action( 'woocommerce_before_shop_loop_item_title', 'glaza_loop_wishlist', 20 );
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_add_to_cart', 25 );
add_action( 'woocommerce_before_shop_loop_item_title', 'glaza_buttons_wrapper_close', 95 );
add_action( 'woocommerce_before_shop_loop_item_title', 'glaza_loop_product_thumbnail', 10 );
add_action( 'woocommerce_shop_loop_item_title', 'glaza_loop_product_title', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 12 );
add_filter( 'woocommerce_loop_add_to_cart_link', 'glaza_loop_add_to_cart_wrapper', 20 );
//checkout
add_action( 'woocommerce_checkout_before_customer_details', 'glaza_checkout_customer_details_before' );
add_action( 'woocommerce_checkout_after_customer_details', 'glaza_checkout_customer_details_after' );
add_action( 'woocommerce_checkout_after_order_review', 'glaza_checkout_order_after' );
//cart
add_action( 'woocommerce_after_cart', 'glaza_cart_after', 20 );
add_action( 'woocommerce_after_cart', 'woocommerce_cross_sell_display', 25 );
//single product
add_action( 'woocommerce_before_single_product', 'glaza_single_product_before', 5 );
add_action( 'woocommerce_after_single_product', 'glaza_single_product_after', 25 );
add_filter( 'woocommerce_add_to_cart_fragments', 'glaza_wc_add_to_cart_fragments', 10 );
add_filter( 'woocommerce_breadcrumb_defaults', 'glaza_wc_breadcrumb' );
add_action( 'woocommerce_before_single_product_summary', 'glaza_single_product_image_before', 1 );
add_action( 'woocommerce_before_single_product_summary', 'glaza_single_product_summary_before', 100 );
add_action( 'woocommerce_after_single_product_summary', 'glaza_single_product_summary_after', 1 );
add_filter( 'woocommerce_product_additional_information_heading', 'glaza_additional_information_heading' );
add_filter( 'woocommerce_get_image_size_single', 'glaza_wc_image_size_single', 10 );
add_filter( 'woocommerce_product_tabs', 'glaza_wc_review_box' );
add_filter( 'woocommerce_output_related_products_args', 'glaza_wc_related_posts_per_page' );
//cross sells
add_filter( 'woocommerce_cross_sells_columns', 'glaza_wc_cross_sells_columns' );
add_filter( 'woocommerce_sale_flash', 'glaza_wc_sale_percent', 10, 3 );
//sidebar shop
add_filter( 'loop_shop_columns', 'glaza_wc_shop_columns' );
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar' );
add_action( 'woocommerce_after_main_content', 'woocommerce_get_sidebar', 5 );
add_action( 'woocommerce_after_main_content', 'glaza_wc_after_sidebar', 6 );
add_action( 'woocommerce_before_shop_loop', 'glaza_wc_before_shop_loop', 5 );
add_action( 'woocommerce_after_shop_loop', 'glaza_wc_after_shop_loop', 99 );
add_action( 'woocommerce_no_products_found', 'glaza_wc_before_shop_loop', 5 );
add_action( 'woocommerce_no_products_found', 'glaza_wc_after_shop_loop', 99 );
/**
* wishlist
*/
if ( ! function_exists( 'glaza_loop_wishlist' ) ) :
function glaza_loop_wishlist() {
$wishlist = glaza_get_option( 'wc_wishlist' );
if ( ! empty( $wishlist ) && shortcode_exists( 'yith_wcwl_add_to_wishlist' ) ) {
echo do_shortcode( '[yith_wcwl_add_to_wishlist]' );
}
}
endif;
if ( ! function_exists( 'glaza_loop_add_to_cart_wrapper' ) ) :
function glaza_loop_add_to_cart_wrapper( $content ) {
return '<div class="add-to-cart">' . $content . '</div>';
}
endif;
if ( ! function_exists( 'glaza_buttons_wrapper_open' ) ) :
function glaza_buttons_wrapper_open() {
echo '<div class="product-buttons cart-tooltips">';
}
endif;
if ( ! function_exists( 'glaza_buttons_wrapper_close' ) ) :
function glaza_buttons_wrapper_close() {
echo '</div>';
}
endif;
if ( ! function_exists( 'glaza_loop_product_title' ) ) :
function glaza_loop_product_title() {
?>
<h2 class="woocommerce-loop-product__title">
<a href="<?php echo get_the_permalink(); ?>" class="woocommerce-loop-product-link"><?php the_title(); ?></a>
</h2>
<?php
}
endif;
if ( ! function_exists( 'glaza_loop_product_thumbnail' ) ) :
function glaza_loop_product_thumbnail() {
?>
<a href="<?php echo get_the_permalink(); ?>" class="woocommerce-loop-product-link"> <?php echo woocommerce_get_product_thumbnail(); ?></a>
<?php
}
endif;
if ( ! function_exists( 'glaza_checkout_customer_details_before' ) ):
function glaza_checkout_customer_details_before() {
?>
<div class="checkout-col col-left">
<?php
}
endif;
if ( ! function_exists( 'glaza_checkout_customer_details_after' ) ):
function glaza_checkout_customer_details_after() {
?>
</div><div class="checkout-col col-right">
<?php
}
endif;
if ( ! function_exists( 'glaza_checkout_order_after' ) ):
function glaza_checkout_order_after() {
?>
</div>
<?php
}
endif;
if ( ! function_exists( 'glaza_cart_after' ) ):
function glaza_cart_after() {
?>
<div class="clearfix"></div>
<?php
}
endif;
/**
* before product page
*/
if ( ! function_exists( 'glaza_single_product_before' ) ):
function glaza_single_product_before() {
?>
<div class="single-product-wrap clearfix">
<?php
}
endif;
/*
* after product page
*/
if ( ! function_exists( 'glaza_single_product_after' ) ):
function glaza_single_product_after() {
?>
</div>
<?php
}
endif;
/**
* @param $args
*
* @return mixed
* breadcrumb filter
*/
if ( ! function_exists( 'glaza_wc_breadcrumb' ) ):
function glaza_wc_breadcrumb( $args ) {
$args['wrap_before'] = '<nav class="breadcrumb woocommerce-breadcrumb"><div class="breadcrumb-inner">';
$args['wrap_after'] = '</div></nav>';
return $args;
}
endif;
/**
* single product
*/
if ( ! function_exists( 'glaza_single_product_image_before' ) ):
function glaza_single_product_image_before() {
?>
<div class="col-wrap single-product-content clearfix"><div class="col-el-2 col-left">
<?php
}
endif;
if ( ! function_exists( 'glaza_single_product_summary_before' ) ):
function glaza_single_product_summary_before() {
?>
</div>
<div class="col-el-2 col-right">
<?php
}
endif;
if ( ! function_exists( 'glaza_single_product_summary_after' ) ):
function glaza_single_product_summary_after() {
?>
</div></div>
<?php
}
endif;
/**
* shop the post data
*/
if ( ! function_exists( 'glaza_shop_the_post_data' ) ) :
function glaza_shop_the_post_data( $post_id = null ) {
if ( empty( $post_id ) ) {
$post_id = get_the_ID();
}
$product_ids = get_post_meta( $post_id, 'glaza_meta_shop_product', true );
$filter = get_post_meta( $post_id, 'glaza_meta_shop_filter', true );
$category_ids = get_post_meta( $post_id, 'glaza_meta_shop_cat', true );
$total_product = get_post_meta( $post_id, 'glaza_meta_shop_total', true );
if ( ! empty( $product_ids ) ) :
$product_ids = trim( $product_ids );
$settings = array(
'post_type' => 'product',
'no_found_rows' => true,
'post_in' => $product_ids
);
return glaza_query_custom( $settings );
elseif ( ! empty( $filter ) ) :
$settings = array(
'post_type' => 'product',
'no_found_rows' => true
);
switch ( $filter ) {
case 'last' :
$settings['orderby'] = 'date_post';
break;
case 'featured' :
$settings['tax_query'] = array(
'taxonomy' => 'product_visibility',
'terms' => 'featured',
'field' => 'name',
'operator' => 'IN',
'include_children' => false,
);
$settings['orderby'] = 'date_post';
break;
case 'sale' :
$settings['post_in'] = array_merge( array( 0 ), wc_get_product_ids_on_sale() );
break;
case 'best_sale' :
$settings['meta_key'] = 'total_sales';
break;
case 'rated' :
$settings['meta_key'] = '_wc_average_rating';
break;
}
if ( ! empty( $category_ids ) ) {
$settings['categories'] = $category_ids;
}
if ( ! empty( $total_product ) ) {
$settings['posts_per_page'] = $total_product;
}
return glaza_query_custom( $settings );
else :
return false;
endif;
}
endif;
if ( ! function_exists( 'glaza_additional_information_heading' ) ) :
function glaza_additional_information_heading( $heading ) {
return false;
}
endif;
/**
* @param $size
*
* @return mixed
* single image height
*/
if ( ! function_exists( 'glaza_wc_image_size_single' ) ) :
function glaza_wc_image_size_single( $size ) {
if ( ! empty( $size['width'] ) ) {
$size['height'] = intval( $size['width'] * 1.5 );
}
$size['crop'] = 1;
return $size;
}
endif;
/**
* review box
*/
if ( ! function_exists( 'glaza_wc_review_box' ) ) :
function glaza_wc_review_box( $tabs ) {
$check = glaza_get_option( 'wc_box_review' );
if ( empty( $check ) ) {
unset( $tabs['reviews'] );
}
return $tabs;
}
endif;
if ( ! function_exists( 'glaza_wc_related_posts_per_page' ) ) :
function glaza_wc_related_posts_per_page( $args ) {
$total = glaza_get_option( 'wc_related_posts_per_page' );
$args['posts_per_page'] = $total;
$args['columns'] = 4;
return $args;
}
endif;
if ( ! function_exists( 'glaza_wc_cross_sells_columns' ) ) :
function glaza_wc_cross_sells_columns( $columns ) {
return 4;
}
endif;
/**
* sidebar wrapper
*/
if ( ! function_exists( 'glaza_wc_before_shop_loop' ) ):
function glaza_wc_before_shop_loop() {
if ( is_shop() ):
$glaza_wc_sidebar_position = glaza_get_option( 'wc_shop_sidebar_position' );
elseif ( is_product_category() ) :
$glaza_wc_sidebar_position = glaza_get_option( 'wc_archive_sidebar_position' );
endif;
if ( ! empty( $glaza_wc_sidebar_position ) && 'none' != $glaza_wc_sidebar_position ) : ?>
<div class="site-content has-sidebar is-sidebar-<?php echo esc_attr( $glaza_wc_sidebar_position ) ?>">
<div id="main" class="site-main">
<?php endif;
}
endif;
/**
* sidebar wrapper
*/
if ( ! function_exists( 'glaza_wc_after_shop_loop' ) ):
function glaza_wc_after_shop_loop() {
if ( is_shop() ):
$glaza_wc_sidebar_position = glaza_get_option( 'wc_shop_sidebar_position' );
elseif ( is_product_category() ) :
$glaza_wc_sidebar_position = glaza_get_option( 'wc_archive_sidebar_position' );
endif;
if ( ! empty( $glaza_wc_sidebar_position ) && 'none' != $glaza_wc_sidebar_position ) : ?>
</div>
<?php endif;
}
endif;
/**
* add sidebar wrapper
*/
if ( ! function_exists( 'glaza_wc_after_sidebar' ) ):
function glaza_wc_after_sidebar() {
echo '</div>';
}
endif;
/**
* @return int
* shop columns
*/
if ( ! function_exists( 'glaza_wc_shop_columns' ) ) {
function glaza_wc_shop_columns() {
if ( is_shop() ):
$glaza_wc_sidebar_position = glaza_get_option( 'wc_shop_sidebar_position' );
elseif ( is_product_category() ) :
$glaza_wc_sidebar_position = glaza_get_option( 'wc_archive_sidebar_position' );
endif;
if ( ! empty( $glaza_wc_sidebar_position ) && 'none' != $glaza_wc_sidebar_position ) {
return 3;
} else {
return 4;
}
}
}
if ( ! function_exists( 'glaza_wc_sale_percent' ) ):
function glaza_wc_sale_percent( $html, $post, $product ) {
$sale_percent = glaza_get_option( 'wc_sale_percent' );
if ( empty( $sale_percent ) || 0 == $product->get_regular_price() ) {
return $html;
} else {
$attachment_ids = $product->get_gallery_image_ids();
$class_name = 'onsale percent ';
if ( empty( $attachment_ids ) ) {
$class_name = 'onsale percent without-gallery';
}
$percentage = round( ( ( $product->get_regular_price() - $product->get_sale_price() ) / $product->get_regular_price() ) * 100 );
return '<span class="' . esc_attr( $class_name ) . '"><span class="onsale-inner"><strong>' . '-' . esc_html( $percentage ) . '</strong><i>%' . '</i></span></span>';
}
}
endif;
if ( ! function_exists( 'glaza_wc_add_to_cart_fragments' ) ) {
/**
* @param $fragments
*
* @return mixed
* ajax cart
*/
function glaza_wc_add_to_cart_fragments( $fragments ) {
ob_start(); ?>
<span class="cart-counter"><?php echo sprintf( '%d', WC()->cart->cart_contents_count ); ?></span>
<?php
$fragments['.cart-icon .cart-counter'] = ob_get_clean();
$mini_cart = $fragments['div.widget_shopping_cart_content'];
unset( $fragments['div.widget_shopping_cart_content'] );
$fragments['div.mini-cart-wrap'] = '<div class="mini-cart-wrap woocommerce">' . $mini_cart . '</div>';
return $fragments;
}
}
/* shop post per page */
if ( ! function_exists( 'glaza_wc_shop_total_products' ) ) {
function glaza_wc_shop_total_products( $total ) {
$posts_per_page = glaza_get_option( 'wc_shop_posts_per_page' );
if ( ! empty( $posts_per_page ) ) {
$total = $posts_per_page;
}
return $total;
}
}
add_filter( 'loop_shop_per_page', 'glaza_wc_shop_total_products', 99 );