'; } if ( ! function_exists( 'shop_isle_product_page_wrapper_end' ) ) { /** * After Product content * Closes the wrapping div and section * * @since 1.0.0 * @return void */ function shop_isle_product_page_wrapper_end() { ?>
4, 'columns' => 4, ) ); return $args; } /** * Product gallery thumnail columns * * @return integer number of columns * @since 1.0.0 */ function shop_isle_thumbnail_columns() { return intval( apply_filters( 'shop_isle_product_thumbnail_columns', 4 ) ); } /** * Products per page * * @return integer number of products * @since 1.0.0 */ function shop_isle_products_per_page() { return intval( apply_filters( 'shop_isle_products_per_page', 12 ) ); } /** * Query WooCommerce Extension Activation. * * @var $extension main extension class name * @return boolean */ function is_woocommerce_extension_activated( $extension = 'WC_Bookings' ) { return class_exists( $extension ) ? true : false; } /** * Header for shop page * * @since 1.0.0 */ function shop_isle_header_shop_page( $page_title ) { $shop_isle_title = ''; $shop_isle_header_image = get_header_image(); if ( ! empty( $shop_isle_header_image ) ) : $shop_isle_title = '
'; else : $shop_isle_title = '
'; endif; $shop_isle_title .= '
'; $shop_isle_title .= '
'; $shop_isle_title .= '
'; if ( ! empty( $page_title ) ) : $shop_isle_title .= '

' . $page_title . '

'; endif; $shop_isle_shop_id = get_option( 'woocommerce_shop_page_id' ); if ( ! empty( $shop_isle_shop_id ) ) : $shop_isle_page_description = get_post_meta( $shop_isle_shop_id, 'shop_isle_page_description' ); if ( ! empty( $shop_isle_page_description[0] ) ) : $shop_isle_title .= '
' . $shop_isle_page_description[0] . '
'; endif; endif; $shop_isle_title .= '
'; $shop_isle_title .= '
'; $shop_isle_title .= '
'; $shop_isle_title .= '
'; return $shop_isle_title; } /** * New thumbnail size for cart page * * @since 1.0.0 */ function shop_isle_cart_item_thumbnail( $thumb, $cart_item, $cart_item_key ) { $product = get_product( $cart_item['product_id'] ); if ( ! empty( $cart_item['variation'] ) ) { if ( ! empty( $cart_item['variation_id'] ) ) { $product = get_product( $cart_item['variation_id'] ); } } return $product->get_image( 'shop_isle_cart_item_image_size' ); } /** * Products slider on single page product * * @since 1.0.0 */ function shop_isle_products_slider_on_single_page() { $shop_isle_products_slider_single_hide = get_theme_mod( 'shop_isle_products_slider_single_hide' ); if ( isset( $shop_isle_products_slider_single_hide ) && $shop_isle_products_slider_single_hide != 1 ) : echo '
'; echo '
'; elseif ( is_customize_preview() ) : echo '
'; echo '
'; endif; if ( ( isset( $shop_isle_products_slider_single_hide ) && $shop_isle_products_slider_single_hide != 1 ) || is_customize_preview() ) : echo '
'; $shop_isle_products_slider_title = get_theme_mod( 'shop_isle_products_slider_title',__( 'Exclusive products', 'shop-isle' ) ); $shop_isle_products_slider_subtitle = get_theme_mod( 'shop_isle_products_slider_subtitle',__( 'Special category of products', 'shop-isle' ) ); if ( ! empty( $shop_isle_products_slider_title ) || ! empty( $shop_isle_products_slider_subtitle ) ) : echo '
'; echo '
'; if ( ! empty( $shop_isle_products_slider_title ) ) : echo '

' . $shop_isle_products_slider_title . '

'; endif; if ( ! empty( $shop_isle_products_slider_subtitle ) ) : echo '
' . $shop_isle_products_slider_subtitle . '
'; endif; echo '
'; echo '
'; endif; $shop_isle_products_slider_category = get_theme_mod( 'shop_isle_products_slider_category' ); if ( ! empty( $shop_isle_products_slider_category ) && ($shop_isle_products_slider_category != '-') ) : $shop_isle_products_slider_args = array( 'post_type' => 'product', 'posts_per_page' => 10, 'tax_query' => array( array( 'taxonomy' => 'product_cat', 'field' => 'term_id', 'terms' => $shop_isle_products_slider_category, ), ), 'meta_query' => array( array( 'key' => '_visibility', 'value' => 'hidden', 'compare' => '!=', ), ), ); $shop_isle_products_slider_loop = new WP_Query( $shop_isle_products_slider_args ); if ( $shop_isle_products_slider_loop->have_posts() ) : echo '
'; echo ''; echo '
'; endif; else : $shop_isle_products_slider_args = array( 'post_type' => 'product', 'posts_per_page' => 10, 'meta_query' => array( array( 'key' => '_visibility', 'value' => 'hidden', 'compare' => '!=', ), ), ); $shop_isle_products_slider_loop = new WP_Query( $shop_isle_products_slider_args ); if ( $shop_isle_products_slider_loop->have_posts() ) : echo '
'; echo ''; echo '
'; endif; endif; echo '
'; echo '
'; endif; } if ( ! function_exists( 'shop_isle_search_products_no_results_wrapper' ) ) { /** * No results on search wrapper start. */ function shop_isle_search_products_no_results_wrapper() { $shop_isle_body_classes = get_body_class(); if ( is_search() && in_array( 'woocommerce',$shop_isle_body_classes ) && in_array( 'search-no-results',$shop_isle_body_classes ) ) { echo '
'; echo '
'; } } } if ( ! function_exists( 'shop_isle_search_products_no_results_wrapper_end' ) ) { /** * No results on search wrapper end. */ function shop_isle_search_products_no_results_wrapper_end() { $shop_isle_body_classes = get_body_class(); if ( is_search() && in_array( 'woocommerce',$shop_isle_body_classes ) && in_array( 'search-no-results',$shop_isle_body_classes ) ) { echo '
'; echo '
'; } } } if ( ! function_exists( 'shop_isle_always_show_live_cart' ) ) { /** * Force WC_Widget_Cart widget to show on cart and checkout pages * Used for the live cart in header */ function shop_isle_always_show_live_cart() { return false; } } if ( ! function_exists( 'shop_isle_loop_product_thumbnail' ) ) { /** * Get the product thumbnail, or the placeholder if not set. */ function shop_isle_loop_product_thumbnail() { global $product; $image_size = 'shop_catalog'; $shop_isle_gallery_attachment_ids = $product->get_gallery_attachment_ids(); if ( has_post_thumbnail() ) { if ( function_exists( 'wc_get_product_attachment_props' ) ) { $props = wc_get_product_attachment_props( get_post_thumbnail_id(), $product ); echo get_the_post_thumbnail( $product->ID, $image_size, array( 'title' => $props['title'], 'alt' => $props['alt'], )); } if ( ! empty( $shop_isle_gallery_attachment_ids[0] ) ) : echo wp_get_attachment_image( $shop_isle_gallery_attachment_ids[0], $image_size ); endif; } elseif ( ! empty( $shop_isle_gallery_attachment_ids ) ) { if ( ! empty( $shop_isle_gallery_attachment_ids[0] ) ) : echo wp_get_attachment_image( $shop_isle_gallery_attachment_ids[0], $image_size ); endif; if ( ! empty( $shop_isle_gallery_attachment_ids[1] ) ) : echo wp_get_attachment_image( $shop_isle_gallery_attachment_ids[1], $image_size ); endif; } elseif ( function_exists( 'wc_placeholder_img_src' ) ) { $shop_isle_placeholder_img = wc_placeholder_img( $image_size ); if ( ! empty( $shop_isle_placeholder_img ) ) { echo $shop_isle_placeholder_img; } } } }// End if(). if ( ! function_exists( 'shop_isle_woocommerce_taxonomy_archive_description' ) ) { /** * Display WooCommerce product category description on all category archive pages */ function shop_isle_woocommerce_taxonomy_archive_description() { if ( is_tax( array( 'product_cat', 'product_tag' ) ) && get_query_var( 'paged' ) != 0 ) { $description = wc_format_content( term_description() ); if ( $description ) { echo '
' . $description . '
'; } } } } add_action( 'woocommerce_archive_description', 'shop_isle_woocommerce_taxonomy_archive_description' ); if ( ! function_exists( 'shop_isle_woocommerce_product_archive_description' ) ) { /** * Display WooCommerce shop content on all shop pages */ function shop_isle_woocommerce_product_archive_description() { if ( is_post_type_archive( 'product' ) ) { $shop_page = get_post( wc_get_page_id( 'shop' ) ); if ( $shop_page ) { $description = wc_format_content( $shop_page->post_content ); if ( $description ) { echo '
' . $description . '
'; } } } } } /** * Fix for Shop page set up as static frontpage problem with the sidebar */ function shop_isle_woocommerce_breadcrumb() { if ( function_exists( 'woocommerce_breadcrumb' ) ) { if ( is_front_page() ) { echo ''; } else { woocommerce_breadcrumb(); } } } /** * Function to add Out of Stock badge on shop pages */ function shop_isle_outofstock_notify_on_archives() { global $product; if ( function_exists( 'method_exists' ) && method_exists( $product, 'managing_stock' ) && method_exists( $product, 'is_in_stock' ) ) { if ( ! $product->managing_stock() && ! $product->is_in_stock() ) { echo '' . esc_html__( 'Out of Stock','shop-isle' ) . ''; } } }