![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/walla3t.corals.io/wp-content/themes/apper/inc/woocommerce/ |
<?php /** * WooCommerce helper functions * This functions only load if WooCommerce is enabled because * they should be used within Woo loops only. * * @package Apper WordPress theme */ /** * Creates the WooCommerce link for the navbar * * @since 1.0.0 */ if ( ! function_exists( 'acmthemes_wcmenucart_menu_item' ) ) { function acmthemes_wcmenucart_menu_item() { // Classes $classes = array( 'wcmenucart', 'xoo-wsc-cart-trigger' ); // Turn classes into space seperated string $classes = implode( ' ', $classes ); // Return if is in the Elementor edit mode, to avoid error if ( ACMTHEMES_ELEMENTOR_ACTIVE && \Elementor\Plugin::$instance->editor->is_edit_mode() ) { return; } // URL $cart_id = wc_get_page_id( 'cart' ); if ( function_exists( 'icl_object_id' ) ) { $cart_id = icl_object_id( $cart_id, 'page' ); } $url = get_permalink( $cart_id ); // Cart total $display = 'icon_count'; //count by default if ( 'icon_total' == $display ) { $cart_extra = WC()->cart->get_total(); $cart_extra = str_replace( 'amount', 'wcmenucart-details', $cart_extra ); } elseif ( 'icon_count' == $display ) { $cart_extra = '<span class="wcmenucart-details count">'. WC()->cart->get_cart_contents_count() .'</span>'; } elseif ( 'icon_count_total' == $display ) { $cart_extra = '<span class="wcmenucart-details count">'. WC()->cart->get_cart_contents_count() .'</span>'; $cart_total = WC()->cart->get_total(); $cart_extra .= str_replace( 'amount', 'wcmenucart-details', $cart_total ); } else { $cart_extra = ''; } // Get cart icon $icon = 'icon-handbag'; // Cart Icon $cart_icon = '<i class="'. esc_attr( $icon ) .'"></i>'; $cart_icon = apply_filters( 'menu_cart_icon_html', $cart_icon ); ?> <a href="<?php echo esc_url( $url ); ?>" class="<?php echo esc_attr( $classes ); ?>"> <span class="wcmenucart-count"><?php echo wp_kses_post( $cart_icon ); ?><?php echo wp_kses_post( $cart_extra ); ?></span> </a> <?php } } /** * Outputs placeholder image * * @since 1.0.0 */ if ( ! function_exists( 'acmthemes_woo_placeholder_img' ) ) { function acmthemes_woo_placeholder_img() { if ( function_exists( 'wc_placeholder_img_src' ) && wc_placeholder_img_src() ) { $placeholder = '<div class="woo-entry-image clr"><img src="'. wc_placeholder_img_src() .'" alt="'. esc_html__( 'Placeholder Image', 'apper' ) .'" class="woo-entry-image-main" /></div>'; $placeholder = apply_filters( 'woo_placeholder_img_html', $placeholder ); if ( $placeholder ) { echo wp_kses_post( $placeholder ); } } } } /** * Check if product is in stock * * @since 1.0.0 */ if ( ! function_exists( 'acmthemes_woo_product_instock' ) ) { function acmthemes_woo_product_instock( $post_id = '' ) { global $post; $post_id = $post_id ? $post_id : $post->ID; $stock_status = get_post_meta( $post_id, '_stock_status', true ); if ( 'instock' == $stock_status ) { return true; } else { return false; } } } /** * Returns catalog elements positioning * * @since 1.1.9 */ if ( ! function_exists( 'acmthemes_woo_product_elements_positioning' ) ) { function acmthemes_woo_product_elements_positioning() { // Default sections $sections = array( 'image', 'category', 'title', 'price-rating', 'description' , 'button' ); // Turn into array if string if ( $sections && ! is_array( $sections ) ) { $sections = explode( ',', $sections ); } // Apply filters for easy modification $sections = apply_filters( 'woo_product_elements_positioning', $sections ); // Return sections return $sections; } } /** * Returns single product summary elements positioning * * @since 1.1.9 */ if ( ! function_exists( 'acmthemes_woo_summary_elements_positioning' ) ) { function acmthemes_woo_summary_elements_positioning() { // Default sections $sections = array( 'title', 'rating', 'price', 'excerpt', 'quantity-button', 'meta' ); // Turn into array if string if ( $sections && ! is_array( $sections ) ) { $sections = explode( ',', $sections ); } // Apply filters for easy modification $sections = apply_filters( 'woo_summary_elements_positioning', $sections ); // Return sections return $sections; } } function acmthemes_woo_placeholder_img( $src=false ) { if( $src === false ) { $output = "<img src='" . get_template_directory_uri() . "/assets/img/placeholder.png' alt='placeholder' />" ; } else { $output = get_template_directory_uri() . "/assets/img/placeholder.png"; } return wp_kses_post( $output ); }