[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: woocommerce.php
<?php /** * WooCommerce Compatibility File * * @link https://woocommerce.com/ * * @package Orchid_Store */ /** * 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 orchid_store_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', 'orchid_store_woocommerce_setup' ); /** * WooCommerce specific scripts & stylesheets. * * @return void */ function orchid_store_woocommerce_scripts() { //wp_enqueue_style( 'orchid-store-woocommerce-style', get_template_directory_uri() . '/woocommerce.css' ); $font_path = WC()->plugin_url() . '/assets/fonts/'; $inline_font = '@font-face { font-family: "star"; src: url("' . $font_path . 'star.eot"); src: url("' . $font_path . 'star.eot?#iefix") format("embedded-opentype"), url("' . $font_path . 'star.woff") format("woff"), url("' . $font_path . 'star.ttf") format("truetype"), url("' . $font_path . 'star.svg#star") format("svg"); font-weight: normal; font-style: normal; }'; wp_add_inline_style( 'orchid-store-woocommerce-style', $inline_font ); } add_action( 'wp_enqueue_scripts', 'orchid_store_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 orchid_store_woocommerce_active_body_class( $classes ) { $classes[] = 'woocommerce-active'; return $classes; } add_filter( 'body_class', 'orchid_store_woocommerce_active_body_class' ); /** * Products per page. * * @return integer number of products. */ function orchid_store_woocommerce_products_per_page() { return 12; } add_filter( 'loop_shop_per_page', 'orchid_store_woocommerce_products_per_page' ); /** * Product gallery thumnbail columns. * * @return integer number of columns. */ function orchid_store_woocommerce_thumbnail_columns() { return 4; } add_filter( 'woocommerce_product_thumbnails_columns', 'orchid_store_woocommerce_thumbnail_columns' ); /** * Default loop columns on product archives. * * @return integer products per row. */ function orchid_store_woocommerce_loop_columns() { if( !empty( orchid_store_get_option( 'shop_product_col_no' ) ) ) { return absint( orchid_store_get_option( 'shop_product_col_no' ) ); } else { return 3; } } add_filter( 'loop_shop_columns', 'orchid_store_woocommerce_loop_columns' ); /** * Related Products Args. * * @param array $args related products args. * @return array $args related products args. */ function orchid_store_woocommerce_related_products_args( $args ) { $defaults = array(); if( !empty( orchid_store_get_option( 'related_product_col_no' ) ) && !empty( orchid_store_get_option( 'related_product_no' ) ) ) { $defaults['columns'] = absint( orchid_store_get_option( 'related_product_col_no' ) ); $defaults['posts_per_page'] = absint( orchid_store_get_option( 'related_product_no' ) ); } else { $defaults['columns'] = 3; $defaults['posts_per_page'] = 3; } $args = wp_parse_args( $defaults, $args ); return $args; } add_filter( 'woocommerce_output_related_products_args', 'orchid_store_woocommerce_related_products_args' ); if ( ! function_exists( 'orchid_store_woocommerce_product_columns_wrapper' ) ) { /** * Product columns wrapper. * * @return void */ function orchid_store_woocommerce_product_columns_wrapper() { $columns = orchid_store_woocommerce_loop_columns(); echo '<div class="columns-' . absint( $columns ) . '">'; } } add_action( 'woocommerce_before_shop_loop', 'orchid_store_woocommerce_product_columns_wrapper', 40 ); if ( ! function_exists( 'orchid_store_woocommerce_product_columns_wrapper_close' ) ) { /** * Product columns wrapper close. * * @return void */ function orchid_store_woocommerce_product_columns_wrapper_close() { echo '</div>'; } } add_action( 'woocommerce_after_shop_loop', 'orchid_store_woocommerce_product_columns_wrapper_close', 40 ); /** * Sample implementation of the WooCommerce Mini Cart. * * You can add the WooCommerce Mini Cart to header.php like so ... * <?php if ( function_exists( 'orchid_store_woocommerce_header_cart' ) ) { orchid_store_woocommerce_header_cart(); } ?> */ if ( ! function_exists( 'orchid_store_woocommerce_cart_link_fragment' ) ) { /** * Cart Fragments. * * Ensure cart contents update when products are added to the cart via AJAX. * * @param array $fragments Fragments to refresh via AJAX. * @return array Fragments to refresh via AJAX. */ function orchid_store_woocommerce_cart_link_fragment( $fragments ) { ob_start(); orchid_store_woocommerce_cart_link(); $fragments['a.cart-contents'] = ob_get_clean(); return $fragments; } } add_filter( 'woocommerce_add_to_cart_fragments', 'orchid_store_woocommerce_cart_link_fragment' ); if ( ! function_exists( 'orchid_store_woocommerce_cart_link' ) ) { /** * Cart Link. * * Displayed a link to the cart including the number of items present and the cart total. * * @return void */ function orchid_store_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', 'orchid-store' ); ?>"> <?php $item_count_text = sprintf( /* translators: number of items in the mini cart. */ _n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), 'orchid-store' ), WC()->cart->get_cart_contents_count() ); ?> <span class="amount"><?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></span> <span class="count"><?php echo esc_html( $item_count_text ); ?></span> </a> <?php } } /** * Change number of upsells output */ function orchid_store_upsell_products_args( $args ) { if( orchid_store_get_option( 'upsell_product_col_no' ) ) { $args['columns'] = absint( orchid_store_get_option( 'upsell_product_col_no' ) ); } else { $args['columns'] = 3; //change number of upsells here } return $args; } add_filter( 'woocommerce_upsell_display_args', 'orchid_store_upsell_products_args', 20 ); /** * Change number of cross sells column */ function orchid_store_cross_sells_columns( $columns ) { if( orchid_store_get_option( 'cross_sell_product_col_no' ) ) { $columns = absint( orchid_store_get_option( 'cross_sell_product_col_no' ) ); } return $columns; } add_filter( 'woocommerce_cross_sells_columns', 'orchid_store_cross_sells_columns' ); if( ! function_exists( 'orchid_store_add_to_cart_fragments' ) ) { function orchid_store_add_to_cart_fragments( $fragments ) { ob_start(); ?> <span class="woocommerce-Price-amount amount os-minicart-amount"><?php echo wp_kses_post( WC()->cart->get_cart_subtotal() ); ?></span> <?php $fragments['.os-minicart-amount'] = ob_get_clean(); return $fragments; } } add_filter( 'woocommerce_add_to_cart_fragments', 'orchid_store_add_to_cart_fragments' ); /** * Defining custom hooks from woocommerce functions */ add_action( 'orchid_store_loop_product_link_open', 'woocommerce_template_loop_product_link_open', 10 ); add_action( 'orchid_store_loop_product_link_close', 'woocommerce_template_loop_product_link_close', 10 ); add_action( 'orchid_store_loop_product_thumbnail', 'woocommerce_template_loop_product_thumbnail', 10 ); add_action( 'orchid_store_loop_add_to_cart', 'woocommerce_template_loop_add_to_cart', 10 ); add_action( 'orchid_store_loop_sale_flash', 'woocommerce_show_product_loop_sale_flash', 10 ); add_action( 'orchid_store_shop_loop_item_title', 'orchid_store_template_loop_product_title' ); add_action( 'orchid_store_product_thumbnail', 'orchid_store_template_loop_product_thumbnail' ); add_action( 'orchid_store_loop_product_quick_link', 'orchid_store_template_loop_product_quick_link' ); remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 ); add_action( 'orchid_store_woocommerce_breadcrumb', 'woocommerce_breadcrumb', 20, 0 ); add_action( 'woocommerce_before_add_to_cart_quantity', 'orchid_store_quantity_plus' ); add_action( 'woocommerce_after_add_to_cart_quantity', 'orchid_store_quantity_minus' );
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server05.hostinghome.co.in
Server IP: 192.168.74.40
PHP Version: 7.4.33
Server Software: Apache
System: Linux server05.hostinghome.co.in 3.10.0-962.3.2.lve1.5.81.el7.x86_64 #1 SMP Wed May 31 10:36:47 UTC 2023 x86_64
HDD Total: 1.95 TB
HDD Free: 691.55 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Disabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: itsweb
User ID (UID): 1619
Group ID (GID): 1621
Script Owner UID: 1619
Current Dir Owner: 1619