1) {
$class_content = 'col-md-9';
}
?>
woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?>
1) {
if ($layout == 2) {
add_action ('woocommerce_before_main_content', 'anaglyph_get_woo_sidebar_content', 6);
} else {
add_action ('woocommerce_after_main_content', 'anaglyph_get_woo_sidebar_content', 98);
}
}
}
}
add_filter( 'loop_shop_per_page', 'anaglyph_woo_set_product_per_page', 20 );
if ( ! function_exists( 'anaglyph_woo_set_product_per_page' ) ) {
function anaglyph_woo_set_product_per_page($cols) {
global $anaglyph_config;
if ((int) $anaglyph_config['shop-product-perpage'] > 0) {
return (int) $anaglyph_config['shop-product-perpage'];
}
}
}
add_filter('loop_shop_columns', 'anaglyph_woo_loop_columns');
if (!function_exists('anaglyph_woo_loop_columns')) {
function anaglyph_woo_loop_columns() {
global $anaglyph_config, $anaglyph_is_redux_active;
if ($anaglyph_is_redux_active ) {
if ((int) $anaglyph_config['shop-product-perrow'] > 0) {
return (int) $anaglyph_config['shop-product-perrow'];
}
} else {
return 4;
}
}
}
if (!function_exists('anaglyph_woo_get_column_class')) {
function anaglyph_woo_get_column_class() {
global $anaglyph_config;
if ((int) $anaglyph_config['shop-product-perrow'] > 0) {
return 'woo-column-' . $anaglyph_config['shop-product-perrow'];
} else {
return 'woo-column-4';
}
}
}
add_action( 'woocommerce_before_shop_loop_item_title', 'anaglyph_woo_set_products_image_size', 10 );
if (!function_exists('anaglyph_woo_set_image_size')) {
function anaglyph_woo_set_products_image_size() {
global $anaglyph_config;
if ((int) $anaglyph_config['shop-product-perrow'] == 2) {
echo woocommerce_get_product_thumbnail(array(560, 560));
} else if ((int) $anaglyph_config['shop-product-perrow'] == 3) {
echo woocommerce_get_product_thumbnail(array(420, 420));
} else {
echo woocommerce_get_product_thumbnail();
}
}
}
if ( ! function_exists( 'anaglyph_woo_breadcrumbs' ) ) {
function anaglyph_woo_breadcrumbs() {
global $anaglyph_config, $anaglyph_is_redux_active;
if (!empty($anaglyph_config['pp-breadcrumbs']) || !$anaglyph_is_redux_active) {
if ($anaglyph_config['pp-breadcrumbs'] || !$anaglyph_is_redux_active) {
$args = array();
$args = apply_filters( 'woocommerce_breadcrumb_defaults', array(
'delimiter' => '',
'wrap_before' => '',
'before' => '',
'after' => '',
'home' => _x( 'Home', 'breadcrumb', 'anaglyph-lite' ),
) );
woocommerce_breadcrumb($args);
}
}
}
}
if ( ! function_exists( 'anaglyph_woo_product_custom_classes' ) ) {
function anaglyph_woo_product_custom_classes( $classes ) {
global $post, $woocommerce, $product, $anaglyph_config;
$attachment_ids = '';
$columns_in = (int) $anaglyph_config['shop-product-perrow'];
$post_type = get_post_type( get_the_ID() );
if ( $post_type == 'product' ) {
$productObj = new WC_Product($product);
$attachment_ids = $productObj->get_gallery_attachment_ids();
if (!empty($attachment_ids)) {
$classes[] = 'anaglyph-woo-has-gallery';
}
}
return $classes;
}
}
add_filter( 'post_class', 'anaglyph_woo_product_custom_classes' );
if ( ! function_exists( 'anaglyph_woo_template_loop_second_product_thumbnail' ) ) {
function anaglyph_woo_template_loop_second_product_thumbnail() {
global $post, $woocommerce, $product, $anaglyph_config;
$columns_in = (int) $anaglyph_config['shop-product-perrow'];
$attachment_ids = '';
$size = 'full';
$productObj = new WC_Product($product);
$attachment_ids = $productObj->get_gallery_attachment_ids();
if ( !empty($attachment_ids) ) {
$secondary_image_id = $attachment_ids['0'];
if ($columns_in == 2) {
$size = array(560, 560);
} else if ($columns_in == 3) {
$size = array(420, 420);
} else if ($columns_in == 1) {
$size ='full';
} else {
$size = array(258, 258);
}
echo wp_get_attachment_image( $secondary_image_id, $size, '', $attr = array( 'class' => 'anaglyph-second-image attachment-shop-catalog' ) );
}
}
}
add_action( 'woocommerce_before_shop_loop_item_title', 'anaglyph_woo_template_loop_second_product_thumbnail', 11 );