Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Techmarket Child
- *
- * @package techmarket-child
- */
- /**
- * Include all your custom code here
- */
- add_filter( 'woocommerce_product_tabs', 'tm_child_rename_single_product_tabs', 20 );
- function tm_child_rename_single_product_tabs( $tabs ) {
- if ( isset( $tabs['accessories'] ) ) {
- $tabs['accessories']['title'] = esc_html__( 'Frequently Bought Together', 'techmarket' );
- }
- return $tabs;
- }
- add_filter( 'woocommerce_get_related_product_tag_terms', function( $term_ids, $product_id ){
- return array();
- }, 10, 2 );
- add_action( 'wp_footer', 'safe_for_later_script', 99 );
- function safe_for_later_script() {
- ?>
- <script type="text/javascript">
- jQuery(document).on('added_to_savelist', function () {
- if( jQuery('.shop_table.cart tr.cart_item').size()== 1 ){
- jQuery('.cart-collaterals').parent().hide();
- setTimeout("location.reload(true);",1400) } });
- </script>
- <?php
- }
- add_filter('wp_mail_from', 'new_mail_from');
- add_filter('wp_mail_from_name', 'new_mail_from_name');
- function new_mail_from($old)
- {
- return 'info@southernindustrial.ca';
- }
- function new_mail_from_name($old)
- {
- return 'Southern Industrial Store';
- }
- // define the woocommerce_cart_is_empty callback
- function action_woocommerce_cart_is_empty( ) {
- ?>
- <style type="text/css">#ywsfl_general_content{display: none;}</style>
- <?php
- };
- // add the action
- add_action( 'woocommerce_cart_is_empty', 'action_woocommerce_cart_is_empty', 10, 0 );
- // Display the product thumbnail in order view pages
- add_filter( 'woocommerce_order_item_name', 'display_product_image_in_order_item', 20, 3 );
- function display_product_image_in_order_item( $item_name, $item, $is_visible ) {
- // Targeting view order pages only
- if( is_wc_endpoint_url( 'view-order' ) ) {
- $product = $item->get_product(); // Get the WC_Product object (from order item)
- $thumbnail = $product->get_image(array( 300, 300)); // Get the product thumbnail (from product object)
- if( $product->get_image_id() > 0 )
- $item_name = '<div class="item-thumbnail">' . $thumbnail . '</div>' . $item_name;
- }
- return $item_name;
- }
- add_action( 'woocommerce_before_single_product', 'tm_child_use_wc_tabs_in_extended_view', 20 );
- function tm_child_use_wc_tabs_in_extended_view() {
- $style = techmarket_get_single_product_style();
- if ( 'extended' === $style ) {
- remove_action( 'woocommerce_after_single_product_summary', 'techmarket_output_product_data_tabs', 10 );
- add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
- }
- }
- // show inout qty when stock are low
- add_filter( 'woocommerce_quantity_input_args', 'custom_quantity_input_args', 20, 2 );
- function custom_quantity_input_args( $args, $product ) {
- if( $product->get_stock_quantity() == 1 && is_product() ){
- $args['min_value'] = 0;
- }
- return $args;
- }
- add_action( 'load-profile.php', function() {
- if( ! current_user_can( 'manage_options' ) )
- exit( wp_safe_redirect( admin_url() ) );
- } );
- add_action ('init' , 'wpse_redirect_profile_access');
- function wpse_redirect_profile_access(){
- //admin won't be affected
- if (current_user_can('manage_options')) return '';
- //if we're at admin profile.php page
- if (strpos ($_SERVER ['REQUEST_URI'] , 'wp-admin/profile.php' )) {
- wp_redirect ( home_url( 'https://southernindustrial.ca/en-ca/store/wp-admin/edit.php?post_type=shop_order' )); // to page like: example.com/my-profile/
- exit();
- }
- }
- add_filter('admin_title', 'my_admin_title', 10, 2);
- function my_admin_title($admin_title, $title)
- {
- return get_bloginfo('name').' • '.$title;
- }
- // Title Removal from image
- add_filter( 'wp_get_attachment_image_attributes', 'remove_image_text');
- function remove_image_text( $attr ) {
- unset($attr['title']);
- return $attr;
- }
- function disable_shipping_calc_on_cart( $show_shipping ) {
- if( is_cart() ) {
- return false;
- }
- return $show_shipping;
- }
- add_filter( 'woocommerce_cart_ready_to_calc_shipping', 'disable_shipping_calc_on_cart', 99 );
- // Product thumbnail in checkout
- add_filter( 'woocommerce_cart_item_name', 'product_thumbnail_in_checkout', 20, 3 );
- function product_thumbnail_in_checkout( $product_name, $cart_item, $cart_item_key ){
- if ( is_checkout() ) {
- $thumbnail = $cart_item['data']->get_image(array( 70, 70));
- $image_html = '<div class="product-item-thumbnail">'.$thumbnail.'</div> ';
- $product_name = $image_html . $product_name;
- }
- return $product_name;
- }
- // redirect shop manager
- add_action( 'admin_menu', 'remove_dashboard', 99 );
- function remove_dashboard(){
- remove_menu_page( 'index.php' ); //dashboard
- }
- // remove notices
- add_action('admin_enqueue_scripts', 'ds_admin_theme_style');
- add_action('login_enqueue_scripts', 'ds_admin_theme_style');
- function ds_admin_theme_style() {
- if (!current_user_can( 'manage_options' )) {
- echo '<style>.update-nag, .updated, .notice, .error, .is-dismissible { display: none !important; }</style>';
- }
- }
- //bypass logout confirm
- function wc_bypass_logout_confirmation() {
- global $wp;
- if ( isset( $wp->query_vars['customer-logout'] ) ) {
- wp_redirect( str_replace( '&', '&', wp_logout_url( wc_get_page_permalink( 'myaccount' ) ) ) );
- exit;
- }
- }
- add_action( 'template_redirect', 'wc_bypass_logout_confirmation' );
- //remove adminbar for non-admin
- add_action('after_setup_theme', 'remove_admin_bar');
- function remove_admin_bar() {
- if (!current_user_can('administrator') && !is_admin()) {
- show_admin_bar(false);
- }
- }
- /*REMOVE IMAGE LINK */
- function myprefix_redirect_attachment_page() {
- if ( is_attachment() ) {
- global $post;
- if ( $post && $post->post_parent ) {
- wp_redirect( esc_url( get_permalink( $post->post_parent ) ), 301 );
- exit;
- } else {
- wp_redirect( esc_url( home_url( '/' ) ), 301 );
- exit;
- }
- }
- }
- add_action( 'template_redirect', 'myprefix_redirect_attachment_page' );
- /* CHANGE ADD-TO-CART-TEXT-ON-CLICK */
- add_action( 'wp_footer', 'single_add_to_cart_event_text_replacement' );
- function single_add_to_cart_event_text_replacement() {
- global $product;
- if( ! is_product() ) return; // Only single product pages
- if( $product->is_type('variable') ) return; // Not variable products
- ?>
- <script type="text/javascript">
- (function($){
- $('button.single_add_to_cart_button').click( function(){
- $(this).text('<?php _e( "Adding...", "woocommerce" ); ?>');
- $(this).addClass("atc_active");
- return true
- });
- })(jQuery);
- </script>
- <?php
- }
- /*CLEAR SHIPPING RATE CACHE*/
- add_filter('woocommerce_checkout_update_order_review', 'clear_wc_shipping_rates_cache');
- function clear_wc_shipping_rates_cache(){
- $packages = WC()->cart->get_shipping_packages();
- foreach ($packages as $key => $value) {
- $shipping_session = "shipping_for_package_$key";
- unset(WC()->session->$shipping_session);
- }
- }
- /* Prevent update notification for plugin */
- function disable_plugin_updates( $value ) {
- $pluginsToDisable = [
- 'yith-woocommerce-one-click-checkout-premium/init.php',
- 'yith-woocommerce-order-tracking-premium/init.php',
- 'woocommerce-bulk-order-form/wc-bulk-order-form.php',
- 'perfmatters/perfmatters.php',
- 'yith-woocommerce-wishlist-premium/init.php',
- 'yith-woocommerce-sms-notifications-premium/init.php',
- 'yith-woocommerce-compare/init.php',
- 'yith-live-chat-premium/init.php',
- 'kingcomposer/kingcomposer.php',
- 'admin-menu-editor-pro/menu-editor.php',
- 'dokan-lite/dokan.php',
- 'woocommerce-email-control/ec-email-control.php',
- 'contact-form-7/wp-contact-form-7.php',
- 'regenerate-thumbnails/regenerate-thumbnails.php',
- 'booster-plus-for-woocommerce/booster-plus-for-woocommerce.php',
- 'yith-woocommerce-bulk-product-editing-premium/init.php',
- 'igniteup/igniteup.php',
- 'yith-woocommerce-save-for-later-premium/init.php'
- ];
- if ( isset($value) && is_object($value) ) {
- foreach ($pluginsToDisable as $plugin) {
- if ( isset( $value->response[$plugin] ) ) {
- unset( $value->response[$plugin] );
- }
- }
- }
- return $value;
- }
- add_filter( 'site_transient_update_plugins', 'disable_plugin_updates' );
- function my_custom_css() {
- if (function_exists('is_shop') && is_shop()) {
- echo "<style type='text/css'>span.gamma.widget-title {border-bottom: 1px solid #ebebeb !important;padding-bottom: .25em !important;}#content.active-hh-sidebar::before {display:none !important;}.star-rating {width: 6.2em;}.select2-dropdown {z-index: 1000000000 !important;}#secondary .widget.widget_price_filter .price_slider_amount button {font-size: 1.068em !important;}header.section-header h1 {color: #fff !important;} @media (max-width: 1589px) and (min-width: 1025px){.jumbotron{margin-bottom: 0px;} }.woocommerce-info {background-color:transparent;color:#333;border-left:0;}@media (max-width: 767px){.jumbotron{display:none;}.products .product .techmarket-product-rating {display:block !important;} } .woocommerce-product-details__short-description p {display: none;} select.techmarket-wc-wppp-select.c-select option:nth-child(n+4) {display: none;} } .logged-in .yith-wcwl-add-to-wishlist .add_to_wishlist::before, .yith-wcwl-add-to-wishlist .yith-wcwl-wishlistaddedbrowse a::before, .yith-wcwl-add-to-wishlist .yith-wcwl-wishlistexistsbrowse a::before {display: block;} .user-not-logged-in .yith-wcwl-add-to-wishlist a:before {display: none;} .yith-wcwl-add-button.show a:before,.yith-wcwl-wishlistexistsbrowse.show a:before {top: -2px;right: 4px;} @media (max-width: 480px) and (min-width: 320px) { .yith-wcwl-add-button.show a:before, .yith-wcwl-wishlistexistsbrowse.show a:before {top: -10px; left: 140px; } } #grid-extended .products .product .star-rating, .products .list-view-large.product .star-rating, .products .list-view-small.product .star-rating, .products .list-view.product .star-rating {margin-top: 4px !important;} a.button.product_type_simple {display:none!important;} .current-cat ul.children {margin-bottom:10px!important;margin-top:10px!important;}.current-cat ul.children li {border-bottom:none!important;} .current-cat {padding-top:10px;padding-bottom:10px;} #content.active-hh-sidebar .content-area::after {z-index: 9999999;} .current-cat .children li a {padding-top: 0px !important;} @media only screen and (min-width : 1200px) and (max-width : 1399px) { .slick-track{width: 100% !important} .slick-slide {width: 100% !important;} } .slick-track{display:flex;} .woocommerce-product-details__short-description ul:nth-child(2) { color: #404040!important; opacity: 1!important } @media (max-width: 1024px) and (min-width: 768px) {.jumbotron .jumbotron-caption { padding: 55px 29% 55px 25px; } } #loftloader-wrapper {z-index: 999999999;} span.review-count { margin-top: 2px; display: inline-block; } h2.woocommerce-loop-product__title {height:38px;} #grid-extended .products .product { margin-bottom:20px;} .woocommerce-product-details__short-description {margin-bottom: .314em !important;} #grid-extended .availability { font-size: 11px; color: #b3b2b2; margin-bottom: 10px; letter-spacing: .3px; border-bottom: 0; } .star-rating { margin-bottom: .534em !important } span.techmarket-stock-availability .stock {margin-right:0px;} #secondary li.wc-layered-nav-rating .star-rating { margin-bottom: -2px !important;} #content { animation: 1s fadeIn; animation-fill-mode: forwards; visibility: hidden; } @keyframes fadeIn { 99% { visibility: hidden; } 100% { visibility: visible; } }
- </style>";
- }
- }
- add_action('wp_head', 'my_custom_css' );
- function my_custom_css_2() {
- if (function_exists('is_product') && is_product()) {
- echo "<style type='text/css'>@media (max-width: 1699px) and (min-width: 1200px) { .full-width.extended.single-product .single-product-wrapper .product-actions-wrapper { padding-right:0px !important;} } nav.woocommerce-breadcrumb a:nth-child(9),nav.woocommerce-breadcrumb span:nth-child(10),nav.woocommerce-breadcrumb span:nth-child(8), nav.woocommerce-breadcrumb a:nth-child(7), nav.woocommerce-breadcrumb a:nth-child(11), nav.woocommerce-breadcrumb span:nth-child(12) {display:none !important;} span.posted_in.categories a:nth-child(2) {display: none;} .single-product .single-product-meta .cat-and-sku span.categories {color: #fff;}.single-product .single-product-meta .cat-and-sku span.categories a:hover {color: #444;}.woocommerce-product-details__short-description ul:nth-child(2) {font-family: sfpro;font-size:14px;line-height:18px;font-weight:400;color:#202020!important;opacity: 1!important; } .woocommerce-noreviews{display:none;}.single-product .accessories .flex-columns .products {display:grid;}.single-product .accessories .accessories-wrapper {display:inline-flex;}.accessories .accessories-wrapper a img {width: 82% !important;}.single-product .accessories .flex-columns .products .product {padding: 0;}label[for=wcj_product_per_product_addons_1] span {color: #006699 !important;font-weight: 500;}input#wcj_product_per_product_addons_1 {width:15px; height:15px;font-size:11px;-webkit-appearance: none;border:none;} .single-product .single-product-meta .cat-and-sku span.categories a:focus {color:#444;} .single-product .rating-and-sharing-wrapper>div+div {margin-left:0px;} input[type=checkbox], input[type=radio]:focus {outline: none;} div#tab-local_1 {padding: 62px 40px;} div#tab-local_1 h2 {font-size:20px;} div#tab-local_1 table td, table th {padding: 0;font-family:roboto;font-weight:300;} div#tab-local_1 table th {font-weight:400;} .single-product-meta.product_meta,div#cuzzy-edd-2,div#cuzzy-edd-1 {display:none !important;}.woocommerce-breadcrumb {font-size: 12px!important;margin-bottom: 42px;margin-left: 14px;margin-top: 3px; font-family: roboto; text-transform: uppercase}.woocommerce-breadcrumb a {font-size: 14.5px;text-transform: none; font-family: Rubik, Roboto, sans-serif, Arial;} .woocommerce-breadcrumb span.delimiter+a {padding: .45em 1.055em; display:inline-block;} .user-not-logged-in .related .yith-wcwl-add-to-wishlist a:before {display: none;} .logged-in .related .yith-wcwl-add-to-wishlist a:before {display: block;top: inherit !important;} .single-product .single-product-wrapper .entry-summary .yith-wcwl-add-to-wishlist .add_to_wishlist::before, .single-product .single-product-wrapper .entry-summary .yith-wcwl-add-to-wishlist .yith-wcwl-wishlistaddedbrowse a::before, .single-product .single-product-wrapper .entry-summary .yith-wcwl-add-to-wishlist .yith-wcwl-wishlistexistsbrowse a::before {top: -14px !important;left:inherit;} .woocommerce-breadcrumb:after {content: '#';} @media (max-width: 480px) and (min-width: 320px) { table.shop_attributes th {width:100% !important;} .yith-wcwl-add-to-wishlist .add_to_wishlist::before, .yith-wcwl-add-to-wishlist .yith-wcwl-wishlistaddedbrowse a::before, .yith-wcwl-add-to-wishlist .yith-wcwl-wishlistexistsbrowse a::before {left: inherit; right:0px; top: -10px;} .full-width.extended.single-product .single-product-wrapper .product-actions-wrapper {padding-right:15px; } } div#tab-global_1 h2 {color: #1f1f1f;font-weight: 500;font-size: 19px;} .atc_active {pointer-events: none;} .yith-wcwl-add-to-wishlist a:before {top:-14px !important;left:inherit;} @media (max-width: 1600px) { .woocommerce-breadcrumb a {font-size:12.5px;}.woocommerce-breadcrumb .delimiter {margin: 0 .5em;}.woocommerce-breadcrumb span.delimiter+a {padding: .45em .755em;} .single-product .single-product-wrapper .entry-summary .yith-wcwl-add-to-wishlist .add_to_wishlist::before, .single-product .single-product-wrapper .entry-summary .yith-wcwl-add-to-wishlist .yith-wcwl-wishlistaddedbrowse a::before, .single-product .single-product-wrapper .entry-summary .yith-wcwl-add-to-wishlist .yith-wcwl-wishlistexistsbrowse a::before {right: 0;} } .additional-info {border-radius: 2px;background-color: transparent;font-size: 13px;text-align: left;padding: 7px 0px;border-bottom: 3px solid #ccc;}.tm-best-brands:before {font-size:25px;} #reviews #comments .commentlist li {padding-top:20px;} #respond.comment-respond .comment-form .comment-form-author {padding-right: 0px;} #respond.comment-respond .comment-form .comment-form-email {padding-left: 0px; margin-right: 1px;} .star-rating span:before {color: #ffb900;} #reviews .rating-histogram .rating-bar {margin-bottom: 0.1em;} .single-product .woocommerce-tabs .wc-tab p {font-weight:400;} img.zoomImg {background:#fff;} .geo3 {display: none;} #reviews .advanced-review .advanced-review-rating h2.based-title {border-bottom:1px solid #DDD;} @media (max-width: 1199px) and (min-width: 768px) { .features-list .features .feature { flex: 0 0 100%; max-width: 100%; } } .full-width.extended.single-product .single-product-wrapper .product-actions-wrapper .product-actions form.cart .single_add_to_cart_button {display:block !important;white-space: nowrap;width:100%;} @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) { .single-product .single-product-wrapper .product-images-wrapper .techmarket-single-product-gallery .techmarket-single-product-gallery-images .slick-slide img {width: 70%;} } .full-width.extended.single-product .single-product-wrapper .product-actions-wrapper {border-left: none;} .social-icon {display: flex;margin: 0 auto;padding-top: 20px;padding-bottom: 20px;} .social-icon-img {width: 21px; height: 21px; margin-right: 6px; opacity: .8;} #tab-specification .tm-shop-attributes-detail h2 { border-bottom: 1px solid #ebebeb; font-size: 19px; } #respond.comment-respond .comment-form>p .input-text, #respond.comment-respond .comment-form>p input[type=email], #respond.comment-respond .comment-form>p input[type=password], #respond.comment-respond .comment-form>p input[type=search], #respond.comment-respond .comment-form>p input[type=text], #respond.comment-respond .comment-form>p input[type=url], #respond.comment-respond .comment-form>p textarea {width: 100%;max-width: 675px;border-radius: 0px;border: 1px solid #dcd6d6;} .full-width.extended.single-product .quantity {margin-bottom: 27px;display: flex;} .single-product .single-product-wrapper .product-actions-wrapper .product-actions label {font-size: 14px; } .quantity .qty {width: 3.235801032em;padding-left: 18px;margin-left: 4px;height: 30px;-moz-appearance: textfield; padding-top:3px; padding-bottom:3px;} button.single_add_to_cart_button.button.alt {border-radius: 3px;} .full-width.extended.single-product .single_add_to_cart_button {padding: 12px 4px;} .single-product .product-actions .price {font-size:1.6em;font-weight: 400;} .full-width.extended.single-product .single-product-wrapper .product-actions-wrapper .product-actions .price {margin-bottom: 1.4em } .advanced-review-comment {padding-top:3px !important;} li.seller-name .details a {pointer-events:none;} .product-actions {border:3px solid #e0e0e0;padding: 18px 18px 30px 18px;} .yith-wocc-wrapper {margin-top:6px; width:100%;} button.single_add_to_cart_button.button.alt:before {font-family: 'simple-line-icons';content: '\e04e';display:inline-block;vertical-align:baseline;padding-right:8px;} button.single_add_to_cart_button.button.alt{ border: 1px solid #bfbcbc; background: linear-gradient(to right,#ebf1f5,#f9f9f9); } .pswp__bg {background:#fff;} .pswp__ui--idle .pswp__top-bar {opacity:1;} .pswp__ui--fit .pswp__top-bar {background-color:#000;} .site-header {z-index: 999;} .pswp__counter {display: block !important;} .pswp__top-bar, .pswp__caption {background-color: #000;} .pswp--touch .pswp__button--arrow--left, .pswp--touch .pswp__button--arrow--right {visibility:visible !important; } .pswp__button--fs, .pswp__button--zoom {display:block !important;} @media (max-width: 1199px) { .site-header {z-index:999999!important;} } .pswp {z-index: 999999999999;} .yith-wocc-button-container {display: none;} .yith-wocc-divider {margin-bottom: 0px;margin-top: 10px;} button.single_add_to_cart_button.button.alt:hover {color: #0063d1; border: 1px solid #4D90FE; -webkit-box-shadow: 0px 0px 5px #4D90FE !important; box-shadow: 0px 0px 5px #4D90FE !important; } div#tab-reviews, div#tab-global_1 {border:1px solid #a1a1a1;padding:62px 40px;} #respond.comment-respond .comment-reply-title, #reviews .advanced-review .advanced-review-rating h2.based-title {font-size: 19px;} .woocommerce-notices-wrapper .woocommerce-message a {color:#006699;} div#tab-global_1 .payment-icon-image {width:50px; margin-left: -6px;}span.csc { font-size: 15px; color: #444; font-weight: 500; }span.csc2 { font-weight: 300; font-size: 15px; font-family: roboto; } a.sdet { text-decoration: underline; font-size: 11px; letter-spacing: .8px; margin-left: 4px; vertical-align: middle; } .single-product .rating-and-sharing-wrapper {DISPLAY: block;} .features-list .features {border-radius: 3px;} .tm-free-delivery:before, .tm-free-return:before, .tm-safe-payments:before {color: #969fa6;} .features-list .features {border: none;display: table-row-group;} .features-list .features .feature+.feature {border-left: none;} .features-list .features .feature .media {justify-content: left;} .features-list .features .feature .media .media-body {text-align: left;} .features-list {margin-bottom: 0;} a.button.product_type_simple.add_to_cart_button.ajax_add_to_cart { display: none; } button.pswp__button.pswp__button--arrow--right,button.pswp__button.pswp__button--arrow--left { background: #ddd !important; opacity: 1 !important; border: 1px solid #ddd; width: 30px; } .pswp__button--arrow--right:before {right: -1px;} .pswp__button--arrow--left:before {left: -1px;} .pswp__img--placeholder--blank { background: #fff !important;} .accessories-product.flex-columns h2 { width: 170px; } @media (max-width: 767px) { .single-product .accessories .products .product+.product::after { top: 64px; left: -8px; } .accessories-product.flex-columns h2 { width: 100px; } } .woocommerce-notices-wrapper {display:none;} #loftloader-wrapper {z-index: 9999999;} div#wcj_product_addons p {display: inline-flex;margin-top: 20px;}div#wcj_product_addons p label {padding-left: 6px; font-weight:300; font-family:Roboto; color:#111;} div#wcj_product_addons p label {padding-left:13px;margin-top: -1px;} .product_cat-uncategorized section.related { display: none; } button.pswp__button {background-color: #666!important;} .pswp__counter {color: #333; opacity: 1;font-weight: 500;font-size:15px;}.pswp__top-bar {background-color:#FFF !important;} .pswp__button {opacity:.3;border:1px solid #fff;border-radius:0px;} button.pswp__button:hover {background-color:#666 !important;} h1.product_title.entry-title { font-family: roboto; }
- </style>";
- }
- }
- add_action('wp_head', 'my_custom_css_2' );
- function my_custom_css_3() {
- if (function_exists('is_archive') && is_archive()) {
- echo "<style type='text/css'>.slick-track{margin-top: 20px;margin-bottom: 36px;}.product-categories-carousel .products .product-category:nth-child(odd) {background-color: #f9f9f9;}.products .product-category img {width: 63%;filter: drop-shadow(1.5px 1.5px 1.5px #999);}.products .product-category,.products .product-category:hover {border-right: 15px solid #fff;min-height: 136px; }.products.slick-initialized.slick-slider {margin-left: 5px;margin-right: 0px;}@media (max-width: 767px) { .products .product .techmarket-product-rating {display:block !important;} .products .product-category.slick-slide {min-height:154px;}.shop-archive-header{display:block;}.shop-control-bar-bottom form .techmarket-wc-wppp-select {whites-pace:normal;overflow:hidden;word-wrap: normal !important;}.jumbotron{display:none;}.products .product-category{padding:8px;}.products .product-category img {width:100%;} }@media (max-width: 1023px) {#content.active-hh-sidebar::before {display:none;}.shop-control-bar form select.orderby {background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAVCAMAAAB8FU7dAAAARVBMVEUAAAAzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzP1DjgGAAAAF3RSTlMAwEAQMP7wsHDk4NvQomQgzLaUkIBgUGyLyyAAAABgSURBVBjT1c1HDsAgDARAXCihpv//qQHJB8MP4oO1Gllr04cvI7MVCQgSgrU8E9v9jKSJYgD0XtPrDSDlNnV16utXxIMaaXIPAuWgCV2FAnPXnZKjpd7Zun48NpbE4/oDqKACG5jjiloAAAAASUVORK5CYII='); } }#showMe {animation: cssAnimation 0s .5s forwards;visibility: hidden;}@keyframes cssAnimation { to { visibility: visible; } } select.techmarket-wc-wppp-select.c-select option:nth-child(n+3) {display: none;} .logged-in .yith-wcwl-add-to-wishlist .add_to_wishlist::before, .yith-wcwl-add-to-wishlist .yith-wcwl-wishlistaddedbrowse a::before, .yith-wcwl-add-to-wishlist .yith-wcwl-wishlistexistsbrowse a::before {display: block;} .user-not-logged-in .yith-wcwl-add-to-wishlist a:before {display: none;} .yith-wcwl-add-button.show a:before,.yith-wcwl-wishlistexistsbrowse.show a:before {top: -2px;right: 4px;} @media (max-width: 480px) and (min-width: 320px) {.yith-wcwl-add-button.show a:before, .yith-wcwl-wishlistexistsbrowse.show a:before {top: -10px; left: 140px; } } #grid-extended .products .product .star-rating, .products .list-view-large.product .star-rating, .products .list-view-small.product .star-rating, .products .list-view.product .star-rating {margin-top: 4px !important;}.iceg,.mfp-bg,.mfp-bg ,.mfp-content {display:none !important;} .product-loop-categories .product-category.product:nth-child(n+6) {display:none;} a.button.product_type_simple {display:none!important;} .current-cat ul.children {margin-bottom:10px!important;margin-top:10px!important;}.current-cat ul.children li {border-bottom:none!important;} .current-cat {padding-top:10px;padding-bottom:10px;} #content.active-hh-sidebar .content-area::after {z-index: 9999999;} .current-cat .children li a {padding-top: 0px !important;} .shop-control-bar {padding-bottom:1.1em;margin-top:14px;} @media only screen and (min-width : 1200px) and (max-width : 1399px) { .slick-track{width: 100% !important} .slick-slide {width: 100% !important;} } .slick-track{display:flex;} @media (max-width: 1024px) and (min-width: 768px) {.jumbotron .jumbotron-caption { padding: 55px 29% 55px 25px; } } #loftloader-wrapper {z-index: 999999999;} span.review-count { margin-top: 2px; display: inline-block; } #grid-extended .availability { font-size: 11px; color: #b3b2b2; margin-bottom: 10px; letter-spacing: .3px; border-bottom: 0; } h2.woocommerce-loop-product__title {height:38px;} span.techmarket-stock-availability .stock {margin-right:0px;} #secondary li.wc-layered-nav-rating .star-rating { margin-bottom: -2px !important;} #content { animation: 1s fadeIn; animation-fill-mode: forwards; visibility: hidden; } @keyframes fadeIn { 99% { visibility: hidden; } 100% { visibility: visible; } }</style>";
- }
- }
- add_action('wp_head', 'my_custom_css_3' );
- function my_custom_css_4() {
- if (function_exists('is_404') && is_404()) {
- echo "<style type='text/css'>form.woocommerce-product-search button,h2.widgettitle {display:none;} .products .product img {width:90%;} @media (max-width: 767px) { header.page-header h1 { font-size: 1.7em !important; } } .error404 .fourohfour-columns-2 {border:0px;} </style>";
- }
- }
- add_action('wp_head', 'my_custom_css_4' );
- function techmarket_cart_link() {
- ?>
- <a class="cart-contents" href="<?php echo esc_url( wc_get_cart_url() ); ?>" title="<?php esc_attr_e( 'View your shopping cart', 'techmarket' ); ?>">
- <i class="header-cart-icon <?php echo esc_attr( apply_filters( 'techmarket_header_cart_icon', 'tm tm-shopping-bag' ) ); ?>"></i>
- <span class="count"><?php echo wp_kses_data( WC()->cart->get_cart_contents_count() ); ?></span>
- <span class="amount"><span class="price-label"><?php echo apply_filters( 'techmarket_header_cart_link_label', esc_html__( 'Your Cart', 'techmarket' ) ); ?></span><?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></span>
- </a>
- <?php
- }
- add_filter( 'woocommerce_product_description_heading', '__return_false', 20 );
- add_filter( 'woocommerce_billing_fields', 'bbloomer_move_checkout_email_field', 10, 1 );
- function bbloomer_move_checkout_email_field( $address_fields ) {
- $address_fields['billing_country']['priority'] = 5;
- return $address_fields;
- }
- // always display rating stars
- function my_display_zero_rating_html( $rating_html, $rating ) {
- if ( $rating_html == '' ) {
- $rating_html = '<div class="star-rating">';
- $rating_html .= wc_get_star_rating_html( $rating, 0 );
- $rating_html .= '</div>';
- }
- return $rating_html;
- }
- add_filter( 'woocommerce_product_get_rating_html', 'my_display_zero_rating_html' , 10, 2 );
- remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 );
- add_action('init', 'add_new_star_rating');
- function add_new_star_rating()
- {
- add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 6 );
- }
- function reduce_stock_processing($order_id) {
- wc_reduce_stock_levels($order_id);
- }
- add_action('woocommerce_order_status_processing', 'reduce_stock_processing');
- add_filter( 'woocommerce_get_breadcrumb', 'ed_change_breadcrumb' );
- function ed_change_breadcrumb( $breadcrumb ) {
- if (function_exists('is_product') && is_product()) {
- if(is_singular()){
- array_pop($breadcrumb);
- }
- }
- return $breadcrumb;
- }
- add_action( 'woocommerce_account_dashboard', 'ec_customer_orders' );
- function ec_customer_orders() {
- $current_page = empty( $current_page ) ? 1 : absint( $current_page );
- $customer_orders = wc_get_orders( apply_filters( 'woocommerce_my_account_my_orders_query', array( 'customer' => get_current_user_id(), 'page' => $current_page, 'paginate' => true ) ) );
- wc_get_template(
- 'myaccount/orders.php',
- array(
- 'current_page' => absint( $current_page ),
- 'customer_orders' => $customer_orders,
- 'has_orders' => 0 < $customer_orders->total,
- )
- );
- }
- add_shortcode( 'recently_viewed_products', 'tm_child_recently_viewed_shortcode' );
- function tm_child_recently_viewed_shortcode() {
- $viewed_products = techmarket_get_viewed_products();
- if ( empty( $viewed_products ) ) {
- echo '<div class="no-product">No product found</div> </ br> <p class="no-prd-c"><a class="button wc-backward no-prd" href="https://southernindustrial.ca/en-ca/store/shop/?orderby=date">Start Browsing</a></p>';
- return;
- }
- $title = '<h3>Recently Viewed Products</h3>';
- $product_ids = implode( ",", $viewed_products );
- return '<div class="recently-viewed-products">' . $title . do_shortcode("[products ids='$product_ids' limit=18]") . '</div>';
- }
- function get_subcategory_terms( $terms, $taxonomies, $args ) {
- $new_terms = array();
- $hide_category = array( 906,534,15,1232 );
- if ( in_array( 'product_cat', $taxonomies ) && !is_admin() && is_product() | is_shop() | is_archive() ) {
- foreach ( $terms as $key => $term ) {
- if ( ! in_array( $term->term_id, $hide_category ) ) {
- $new_terms[] = $term;
- }
- }
- $terms = $new_terms;
- }
- return $terms;
- }
- add_filter( 'get_terms', 'get_subcategory_terms', 10, 3 );
- /** Disable Ajax Call from WooCommerce on front page and posts*/
- add_action( 'wp_enqueue_scripts', 'dequeue_woocommerce_cart_fragments', 11);
- function dequeue_woocommerce_cart_fragments() {
- if (is_front_page() || is_single() ) wp_dequeue_script('wc-cart-fragments');
- }
- add_filter( 'techmarket_search_categories_filter_args', 'tm_show_only_root_categories_in_search', 20 );
- function tm_show_only_root_categories_in_search( $args ) {
- $args[ 'hierarchical' ] = 1;
- $args[ 'depth' ] = 2;
- return $args;
- }
- add_action( 'after_setup_theme', 'ec_child_remove_product_gallery_zoom_support', 20 );
- function ec_child_remove_product_gallery_zoom_support() {
- remove_theme_support( 'wc-product-gallery-zoom' );
- }
- function backorder_text($availability) {
- foreach($availability as $i) {
- $availability = str_replace('Available on backorder', 'Backordered', $availability);
- $availability = str_replace('(can be backordered)', '', $availability);
- }
- return $availability;
- }
- add_filter('woocommerce_get_availability', 'backorder_text');
- add_filter('woocommerce_email_order_items_args','remove_order_note',12);
- function remove_order_note($args){
- $args['show_purchase_note']= false;
- return $args;
- }
- add_filter( 'woocommerce_email_order_items_args', 'iconic_email_order_items_args', 10, 1 );
- function iconic_email_order_items_args( $args ) {
- $args['show_image'] = true;
- $args['image_size'] = array( 70, 70 );
- return $args;
- }
- function add_file_types_to_uploads($file_types){
- $new_filetypes = array();
- $new_filetypes['svg'] = 'image/svg+xml';
- $file_types = array_merge($file_types, $new_filetypes );
- return $file_types;
- }
- add_filter('upload_mimes', 'add_file_types_to_uploads');
- add_filter('woocommerce_login_redirect', 'pro_login_redirect');
- function pro_login_redirect( $redirect_to ) {
- $redirect_to = home_url();
- return $redirect_to;
- }
- add_action('admin_head', 'my_custom_fonts');
- function my_custom_fonts() {
- echo '<style>
- p.form-field.form-field-wide.wc-customer-user label[for=customer_user] a, .post-locked-message p a:first-child,div#page-links-to,.misc-pub-section.misc-pub-response-to { display: none; } .energyplus-title--menu ul li:nth-child(3), .energyplus-title--menu ul li:nth-child(5), .energyplus-title--menu ul li:nth-child(6), .energyplus-title--menu ul li:nth-child(9),.energyplus-title--menu ul li:nth-child(11) {display:none;} .col-md-12.col-md-offset-2.text-center { margin-bottom: 50px; } #mymetabox_revslider_0,#postcustom,#woocommerce-order-downloads,.js-wc-plugin-framework-admin-notice.is-dismissible,.updated.woocommerce-message p,.updated.wps-rating,.woocommerce-BlankState a:last-child,.yith-live-chat-console .console-footer span,a.button.tips.edit,a.button.tips.wf-print-label,button.button.wc-reload,button.toggle-sub-orders.button,li#wp-admin-bar-clientside-notification-center{display:none!important}.clientside-theme #poststuff #woocommerce-order-notes .add_note .button.add_note{margin-bottom:60px}.tablenav.bottom{margin-bottom:45px!important}.wp-pointer-right{display:inline-table}.chat-content .chat-cnv-reply{margin-bottom:60px}.select2-container .select2-selection--single{height:41px!important;border-radius:2px!important;border:1px solid #e8e8e8!important}.select2-container--default .select2-selection--single .select2-selection__placeholder{vertical-align:sub}select#dropdown_shop_order_pip_print_status{max-width:210px!important}#order_data .order_data_column .form-field .date-picker{width:40%!important}select#shipping_service_canadapost{margin-bottom:30px!important}select#order_note_type{max-width:80%}textarea#ups_shipment_ids{width:100%;height:65px}.order_actions li#actions select{width:300px!important}li#actions strong{display:inline-grid}@media (min-width:1880px){.wrap{padding:0 28px!important}}.wrap{padding:36px 22px} .woocommerce-layout__header, li#wp-admin-bar-wp-logo, div#screen-meta-links {display:none !important;} #adminmenuback {background-color: #dfe0e3 !important;} #wpbody {background: #f4f5f6} #adminmenu .wp-menu-arrow {background: #f4f5f6!important; color: #000!important;} #adminmenu .wp-has-current-submenu .wp-submenu {background-color: #d2d5dd!important;margin-top:-2px!important;} #adminmenu .wp-submenu a,#adminmenu div.wp-menu-name,#adminmenu .wp-submenu li.current a {color: #000!important;} #adminmenu .wp-has-current-submenu div.wp-menu-image:before,#adminmenu div.wp-menu-image:before {color:#222!important;} #adminmenu {margin-top: 0!important;} a.ab-item:before, #wpfooter,li#wp-admin-bar-eos-dp-menu,ul#wp-admin-bar-site-name-default,.woocommerce-layout{display:none!important;} #wpadminbar #wp-admin-bar-site-name a.ab-item {margin-right: 3px!important;background: #000!important;font-size:12.5px;text-align:center;width:145px;pointer-events: none;}#adminmenu .wp-submenu a:hover, #adminmenu a:hover,#adminmenu li.menu-top:hover {background: #1eabf1!important;color: #000!important;}#adminmenuwrap {background-color: #dfe0e3;} li#collapse-menu { background: #dfe0e3; }.wp-menu-name { background:#d2d5dd; }#adminmenu li.wp-menu-separator {height:0;margin:0;} a.current { background: #f1f1f1; } #adminmenu li>a.menu-top:focus {background-color: #fff;}.folded #adminmenu a.menu-top{background:white;}#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu {background: #dfe0e3;}select#bulk-action-selector-top option:nth-child(n+6),select#bulk-action-selector-bottom option:nth-child(n+6){display:none;} .post-type-shop_order .tablenav .select2-selection--single { height: 31px !important; border: 1px solid #7e8993 !important; margin-top: -1px; }.tablenav span.select2-selection__placeholder { vertical-align: baseline !important; color: #32373c !important; } @media (max-width: 768px) { li#wp-admin-bar-site-name,.wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-primary~td:not(.check-column) { display: none !important; }.auto-fold #adminmenu a.menu-top {background: #d2d5dd !important;} } div#coupon_options span.description a {pointer-events: none; color: #555; text-decoration: none;} #wpbody-content {background:#f1f1f1;} li#wp-admin-bar-new-content { display: none; }
- </style>';
- }
- if ( ! function_exists( 'techmarket_wc_products_per_page' ) ) {
- /**
- * Outputs a dropdown for user to select how many products to show per page
- */
- function techmarket_wc_products_per_page() {
- global $wp_query, $techmarket_options;
- $action = '';
- $cat = '';
- $cat = $wp_query->get_queried_object();
- $method = apply_filters( 'techmarket_wc_ppp_method', 'post' );
- $return_to_first = apply_filters( 'techmarket_wc_ppp_return_to_first', false );
- $total = $wp_query->found_posts;
- $per_page = $wp_query->get( 'posts_per_page' );
- $_per_page = isset( $techmarket_options['products_per_page'] ) ? $techmarket_options['products_per_page'] :techmarket_set_loop_shop_columns() * 4;
- // Generate per page options
- $products_per_page_options = array();
- while( $_per_page < $total ) {
- $products_per_page_options[] = $_per_page;
- $_per_page = $_per_page * 2;
- }
- if ( empty( $products_per_page_options ) ) {
- return;
- }
- $products_per_page_options[] = -1;
- // Set action url if option behaviour is true
- // Paste QUERY string after for filter and orderby support
- $query_string = ! empty( $_SERVER['QUERY_STRING'] ) ? '?' . add_query_arg( array( 'ppp' => false ), $_SERVER['QUERY_STRING'] ) : null;
- if ( isset( $cat->term_id ) && isset( $cat->taxonomy ) && $return_to_first ) :
- $action = get_term_link( $cat->term_id, $cat->taxonomy ) . $query_string;
- elseif ( $return_to_first ) :
- $action = get_permalink( wc_get_page_id( 'shop' ) ) . $query_string;
- endif;
- // Only show on product categories
- if ( ! woocommerce_products_will_display() ) :
- return;
- endif;
- do_action( 'techmarket_wc_ppp_before_dropdown_form' );
- ?><form method="POST" action="<?php echo esc_url( $action ); ?>" class="form-techmarket-wc-ppp"><?php
- do_action( 'techmarket_wc_ppp_before_dropdown' );
- ?><select name="ppp" onchange="this.form.submit()" class="techmarket-wc-wppp-select c-select"><?php
- foreach( $products_per_page_options as $key => $value ) :
- ?><option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, $per_page ); ?>><?php
- $ppp_text = apply_filters( 'techmarket_wc_ppp_text', esc_html__( 'Show %s', 'techmarket' ), $value );
- esc_html( printf( $ppp_text, $value == -1 ? esc_html__( 'All', 'techmarket' ) : $value ) ); // Set to 'All' when value is -1
- ?></option><?php
- endforeach;
- ?></select><?php
- // Keep query string vars intact
- foreach ( $_GET as $key => $val ) :
- if ( 'ppp' === $key || 'submit' === $key ) :
- continue;
- endif;
- if ( is_array( $val ) ) :
- foreach( $val as $inner_val ) :
- ?><input type="hidden" name="<?php echo esc_attr( $key ); ?>[]" value="<?php echo esc_attr( $inner_val ); ?>" /><?php
- endforeach;
- else :
- ?><input type="hidden" name="<?php echo esc_attr( $key ); ?>" value="<?php echo esc_attr( $val ); ?>" /><?php
- endif;
- endforeach;
- do_action( 'techmarket_wc_ppp_after_dropdown' );
- ?></form><?php
- do_action( 'techmarket_wc_ppp_after_dropdown_form' );
- }
- }
- if ( ! function_exists( 'tm_child_replace_sku_additional_info' ) ) {
- function tm_child_replace_sku_additional_info() {
- remove_action( 'woocommerce_after_grid_extended_item_title', 'techmarket_single_product_sku', 16 );
- add_action( 'woocommerce_after_grid_extended_item_title', 'techmarket_single_product_availability', 16 );
- }
- }
- add_action( 'init', 'tm_child_replace_sku_additional_info' );
- // Disable REST API link tag
- remove_action('wp_head', 'rest_output_link_wp_head', 10);
- // Disable oEmbed Discovery Links
- remove_action('wp_head', 'wp_oembed_add_discovery_links', 10);
- // Disable REST API link in HTTP headers
- remove_action('template_redirect', 'rest_output_link_header', 11, 0);
- function my_login_logo() { ?>
- <style type="text/css">
- #login h1 a, .login h1 a {display: none !important;} #login {width: 420px !important;}.login form {background: transparent !important;border: 0!important;box-shadow: none!important;padding-bottom: 150px!important; }.login form .input, .login input[type=password], .login input[type=text] {border-radius: 0 !important; border-color: #222!important;} .wp-core-ui .button-group.button-large .button, .wp-core-ui .button.button-large {width: 100%!important;margin-top: 20px!important;border-radius: 16px!important;} .wp-core-ui .button-primary { background: #9ea1a9 !important; border-color: #fff !important; } form#loginform:before { content: "Log In To SAP CRM"; font-size: 20px; display: block; margin-bottom: 20px; }
- </style>
- <?php }
- add_action( 'login_enqueue_scripts', 'my_login_logo' );
- function hide_update_noticee_to_all_but_admin_users()
- {
- if (!is_super_admin()) {
- remove_all_actions( 'admin_notices' );
- }
- }
- add_action( 'admin_head', 'hide_update_noticee_to_all_but_admin_users', 1 );
Add Comment
Please, Sign In to add comment