Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1410308
    clickwp
    Participant

    I noticed that the image sizes out of the box are extremely large, and there is no way to control them out of the box.

    Here is my client site – https://recycledinteriors.org/

    On the shop page, the images are being displayed at very large sizes causing the page weight to be rather heavy and slow loading. Same for individual product pages and also blog posts.

    I figured out how to control the image sizes on the shop page from this thread – https://community.theme.co/forums/topic/product-images-woocommerce/page/3/#post-1078611

    But I still don’t know how to use a smaller size on product pages like https://recycledinteriors.org/shop/bags-plastic-alternatives/macrame-hanging-planter-jet-white/

    I also want to know how to disable featured images on blog posts. I don’t want to display: none; the image, I want to remove it from the markup completely. I can’t believe there isn’t a setting for this. Does this mean the only way I can remove the featured image is to modify x/views/[stack]/content.php (in a child theme)?

    #1410455
    clickwp
    Participant

    Never mind, I figured it out

    //* Do Not Remove Woocommerce Plugin Settings
    
    function ri_restore_wc_product_images(){
      if ( ! is_admin() ) {
        return;
      }
      remove_filter( 'woocommerce_product_settings', 'x_woocommerce_remove_plugin_settings', 10 );
    }
    add_action('init', 'ri_restore_wc_product_images');
    
    
    //* Respect WC setting for shop thumbnails
    
    function ri_woocommerce_shop_product_thumbnails() {
    
      GLOBAL $product;
    
      $id     = get_the_ID();
      $thumb  = 'shop_catalog';
      $rating = $product->get_rating_html();
    
      woocommerce_show_product_sale_flash();
      echo '<div class="entry-featured">';
        echo '';
          echo get_the_post_thumbnail( $id, $thumb );
          if ( ! empty( $rating ) ) {
            echo '<div class="star-rating-container aggregate">' . $rating . '</div>';
          }
        echo '';
      echo "</div>";
    
    }
    
    add_filter('init', function() {
    	remove_action( 'woocommerce_before_shop_loop_item_title', 'x_woocommerce_shop_product_thumbnails', 10 );
    });
    
    add_action( 'woocommerce_before_shop_loop_item_title', 'ri_woocommerce_shop_product_thumbnails', 10 ); 
    
    
    
    //* Large thumbnail size.
    
    function ri_woocommerce_single_product_large_thumbnail_size() {
      return 'medium_large';
    }
    add_filter( 'single_product_large_thumbnail_size', 'ri_woocommerce_single_product_large_thumbnail_size', 15 );
    
    
    //* Small thumbnail size.
    
    function ri_woocommerce_single_product_small_thumbnail_size() {
      return 'shop_thumbnail';
    }
    
    add_filter( 'single_product_small_thumbnail_size', 'ri_woocommerce_single_product_small_thumbnail_size', 15 );
    
    #1410613
    Nico
    Moderator

    Happy to hear that.

    Thank you so much for sharing the fix to us. It would really help a lot.

    Thanks.

  • <script> jQuery(function($){ $("#no-reply-1410308 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>