Server IP : 66.29.132.124 / Your IP : 13.59.35.116 Web Server : LiteSpeed System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : wavevlvu ( 1524) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/wavevlvu/diixadigital.com/wp-content/themes/meto/includes/woocommerce/ |
Upload File : |
<?php /** * WooCommerce Compatibility File * * @link https://woocommerce.com/ * * @package ONUM */ /** * WooCommerce setup function. * * @link https://docs.woocommerce.com/document/third-party-custom-theme-compatibility/ * @link https://github.com/woocommerce/woocommerce/wiki/Enabling-product-gallery-features-(zoom,-swipe,-lightbox)-in-3.0.0 * * @return void */ function meto_woocommerce_setup() { add_theme_support('woocommerce'); add_theme_support('wc-product-gallery-zoom'); add_theme_support('wc-product-gallery-lightbox'); add_theme_support('wc-product-gallery-slider'); } add_action('after_setup_theme', 'meto_woocommerce_setup'); /** * WooCommerce specific scripts & stylesheets. * * @return void */ function meto_woocommerce_scripts() { wp_enqueue_style('meto-woocommerce-style', get_template_directory_uri() . '/assets/css/woocommerce.css'); if (class_exists('woocommerce')) { wp_enqueue_style('meto-woocommerce-style'); } } add_action('wp_enqueue_scripts', 'meto_woocommerce_scripts'); /** * Add 'woocommerce-active' class to the body tag. * * @param array $classes CSS classes applied to the body tag. * @return array $classes modified to include 'woocommerce-active' class. */ function meto_woocommerce_active_body_class($classes) { $classes[] = 'woocommerce-active'; return $classes; } add_filter('body_class', 'meto_woocommerce_active_body_class'); /** * Product gallery thumnbail columns. * * @return integer number of columns. */ function meto_woocommerce_thumbnail_columns() { return 4; } add_filter('woocommerce_product_thumbnails_columns', 'meto_woocommerce_thumbnail_columns'); /** * Related Products Args. * * @param array $args related products args. * @return array $args related products args. */ function meto_woocommerce_related_products_args($args) { $defaults = array( 'posts_per_page' => 4, 'columns' => 4, ); $args = wp_parse_args($defaults, $args); return $args; } add_filter('woocommerce_output_related_products_args', 'meto_woocommerce_related_products_args'); /** * Remove the breadcrumbs */ add_action('init', 'meto_wc_breadcrumbs'); function meto_wc_breadcrumbs() { remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0); add_action('meto_woocommerce_breadcrumb', 'woocommerce_breadcrumb'); } /** * Change several of the breadcrumb defaults */ add_filter('woocommerce_breadcrumb_defaults', 'meto_woocommerce_breadcrumbs'); function meto_woocommerce_breadcrumbs() { return array( 'delimiter' => '', 'wrap_before' => '<ul id="breadcrumbs" class="breadcrumbs" itemprop="breadcrumb">', 'wrap_after' => '</ul>', 'before' => '<li>', 'after' => '</li>', 'home' => _x('Home', 'breadcrumb', 'meto'), ); } /** * Remove the product link */ remove_action('woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 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); add_action('woocommerce_shop_loop_item_title', 'meto_change_products_title', 10); function meto_change_products_title() { echo '<h2 class="woocommerce-loop-product__title"><a href="'.get_the_permalink().'">' . get_the_title() . '</a></h2>'; } /** * Remove default WooCommerce wrapper. */ remove_action('woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10); remove_action('woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10); if (! function_exists('meto_woocommerce_wrapper_before')) { /** * Before Content. * * Wraps all WooCommerce content in wrappers which match the theme markup. * * @return void */ function meto_woocommerce_wrapper_before() { ?> <div id="primary" class="content-area col-lg-8 col-md-8 col-sm-12 col-xs-12"> <main id="main" class="site-main" role="main"> <?php } } add_action('woocommerce_before_main_content', 'meto_woocommerce_wrapper_before'); if (! function_exists('meto_woocommerce_wrapper_after')) { /** * After Content. * * Closes the wrapping divs. * * @return void */ function meto_woocommerce_wrapper_after() { ?> </main><!-- #main --> </div><!-- #primary --> <?php } } add_action('woocommerce_after_main_content', 'meto_woocommerce_wrapper_after'); if (! function_exists('meto_woocommerce_cart_link')) { /** * Cart Link. * * Displayed a link to the cart including the number of items present and the cart total. * * @return void */ function meto_woocommerce_cart_link() { ?> <a class="cart-contents" href="<?php echo esc_url(wc_get_cart_url()); ?>" title="<?php esc_attr_e('View your shopping cart', 'meto'); ?>"> <i class="flaticon-supermarket"></i> <?php $item_count_text = sprintf( /* translators: number of items in the mini cart. */ _n('%d', '%d', WC()->cart->get_cart_contents_count(), 'meto'), WC()->cart->get_cart_contents_count() ); ?> <span class="count"><?php echo esc_html($item_count_text); ?></span> </a> <?php } } if (! function_exists('meto_woocommerce_header_cart')) { /** * Display Header Cart. * * @return void */ function meto_woocommerce_header_cart() { if (is_cart()) { $class = 'current-menu-item'; } else { $class = ''; } ?> <ul id="site-header-cart" class="site-header-cart"> <li class="<?php echo esc_attr($class); ?>"> <?php meto_woocommerce_cart_link(); ?> </li> <li> <?php $instance = array( 'title' => '', ); the_widget('WC_Widget_Cart', $instance); ?> </li> </ul> <?php } } /** * Register widget area for shop page. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function meto_woocommerce_widgets_init() { register_sidebar(array( 'name' => __('Shop Sidebar', 'meto'), 'id' => 'shop-sidebar', 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h5 class="widget-title">', 'after_title' => '</h5>', )); } add_action('widgets_init', 'meto_woocommerce_widgets_init');