This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter( 'get_terms', 'ts_get_subcategory_terms', 10, 3 ); | |
| function ts_get_subcategory_terms( $terms, $taxonomies, $args ) { | |
| $new_terms = array(); | |
| // if it is a product category and on the shop page | |
| if ( in_array( 'product_cat', $taxonomies ) && ! is_admin() &&is_shop() || is_product_category()) { | |
| foreach( $terms as $key => $term ) { | |
| if ( !in_array( $term->slug, array( 'uncategorised','artist' ) ) ) { //pass the slug name here | |
| $new_terms[] = $term; | |
| }} | |
| $terms = $new_terms; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # --------------------------------------------------------------------------- | |
| # Generate WebP Images - Uses cwebp command line tool for Linux | |
| # This will generate / re-generate all webp images for all JPG and PNG files | |
| # Being command line based it is incredibly fast | |
| # If you don't want to re-generate existing files set generateall=0 | |
| # If you want to re-generate everything set generateall=1 | |
| # USE this script at your own risk and Only if you know what you are doing | |
| # Written by Mitchell Krog - mitchellkrog@gmail.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CSS FOR CUSTOMIZING WOOCOMMERCE MESSAGES | |
| /*---------------------------------------------*/ | |
| /*Make Woocommerce Messages Float Above Content*/ | |
| /*---------------------------------------------*/ | |
| .woocommerce-notices-wrapper { | |
| position:fixed; | |
| top:30%; | |
| left:50%; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This removes the featured image from the single product page | |
| // Your First Gallery Image becomes the main image | |
| add_filter('woocommerce_single_product_image_thumbnail_html', 'remove_featured_image', 10, 2); | |
| function remove_featured_image($html, $attachment_id ) { | |
| global $post, $product; | |
| $featured_image = get_post_thumbnail_id( $post->ID ); | |
| if ( $attachment_id == $featured_image ) | |
| $html = ''; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Plugin Name: WP Rocket | Deactivate WooCommerce Refresh Cart Fragments Cache | |
| * Description: Deactivate the WP Rocket feature that caches WooCommerce Refresh Cart Fragments. | |
| * Plugin URI: https://github.com/wp-media/wp-rocket-helpers/tree/master/compatibility/wp-rocket-compat-wc-cart-fragments | |
| * Author: WP Rocket Support Team | |
| * Author URI: http://wp-rocket.me/ | |
| * License: GNU General Public License v2 or later | |
| * License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
| * | |
| * Copyright SAS WP MEDIA 2018 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action('wp_head', 'inject_flatsome', 5); | |
| function inject_flatsome() { | |
| ob_start(); | |
| include 'wp-content/themes/flatsome/assets/css/flatsome.css'; | |
| $atf_css = ob_get_clean(); | |
| if ($atf_css != "" ) { | |
| $theme = wp_get_theme( get_template() ); | |
| $version = $theme->get( 'Version' ); | |
| $fonts_url = get_template_directory_uri() . '/assets/css/icons'; | |
| $atf_css .= '@font-face { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| global $product; | |
| $attachment_ids = $product->get_gallery_attachment_ids(); | |
| foreach( $attachment_ids as $attachment_id ) | |
| { | |
| //Get URL of Gallery Images - default wordpress image sizes | |
| echo $Original_image_url = wp_get_attachment_url( $attachment_id ); | |
| echo $full_url = wp_get_attachment_image_src( $attachment_id, 'full' )[0]; | |
| echo $medium_url = wp_get_attachment_image_src( $attachment_id, 'medium' )[0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Change backorder message text | |
| function change_backorder_message( $text, $product ){ | |
| if ( $product->managing_stock() && $product->is_on_backorder( 1 ) ) { | |
| $text = __( 'Place your text here', 'woocommerce' ); | |
| } | |
| return $text; | |
| } | |
| add_filter( 'woocommerce_get_availability_text', 'change_backorder_message', 10, 2 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action( 'before_delete_post', 'delete_product_images', 10, 1 ); | |
| function delete_product_images( $post_id ) | |
| { | |
| $product = wc_get_product( $post_id ); | |
| if ( !$product ) { | |
| return; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action( 'woocommerce_email_order_details', 'las_order_email_order_details', 10, 4 ); | |
| function las_order_email_order_details( $order, $sent_to_admin, $plain_text, $email ) { | |
| if($sent_to_admin){ | |
| $order_statuses = array('wc-on-hold', 'wc-processing', 'wc-completed'); | |
| $customer_user_id = get_current_user_id(); | |
| $customer_orders = wc_get_orders( array( | |
| 'meta_key' => '_customer_user', | |
| 'meta_value' => $customer_user_id, | |
| 'post_status' => $order_statuses, | |
| 'numberposts' => -1 |