Advertisement
majeedraza

WooCommerce - Do not show images for subcategories

Feb 16th, 2017
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.51 KB | None | 0 0
  1. <?php
  2.   // WooCommerce - Do not show images for subcategories
  3.   // code goes in functions.php for your child theme
  4.   remove_action( 'woocommerce_before_subcategory_title', 'woocommerce_subcategory_thumbnail', 10 );
  5.   add_action( 'woocommerce_before_subcategory_title', 'custom_subcategory_thumbnail', 10 );
  6.   function custom_subcategory_thumbnail( $category ) {
  7.     if ( $category->parent == '0' ) {
  8.       woocommerce_subcategory_thumbnail( $category );
  9.     } else {
  10.       // do not show a category image
  11.     }
  12.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement