Plugin Directory

Changeset 1888890


Ignore:
Timestamp:
06/07/2018 01:39:15 PM (8 years ago)
Author:
Shellbot
Message:

Fix issue with category image size in newer versions of WooCommerce

Location:
woocommerce-auto-category-thumbnails/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • woocommerce-auto-category-thumbnails/trunk/readme.txt

    r1750656 r1888890  
    33Tags: woocommerce, ecommerce, e-commerce, wordpress ecommerce, shopping, categories
    44Requires at least: 4.0
    5 Tested up to: 4.8.2
     5Tested up to: 4.9.6
    66Donate link: http://patreon.com/shellbot
    77Stable tag: trunk
     
    1313== Description ==
    1414
    15 ** 22/10/17 - Updated for the latest version of WooCommerce **
     15** 07/06/18 - Updated for the latest version of WooCommerce **
    1616
    1717By default, WooCommerce displays a neutral and uninteresting category image placeholder in those cases where a category has
     
    4848== Changelog ==
    4949
     50= 1.2.1 =
     51
     52* Fixed issue with category image size in newer versions of WooCommerce
     53
    5054= 1.2 =
    5155* Fixed incompatibility with latest version of WooCommerce due to changed handling of product visibility setting
  • woocommerce-auto-category-thumbnails/trunk/woocommerce-auto-cat-thumbnails.php

    r1750656 r1888890  
    44Plugin URI: http://codebyshellbot.com/wordpress-plugins/woocommerce-auto-category-thumbnails/
    55Description: Automatically display a relevant product image if category thumbnails are not set.
    6 Version: 1.2
     6Version: 1.2.1
    77Author: Shellbot
    88Author URI: http://codebyshellbot.com
     
    9494        //Query DB
    9595        $product = get_posts( $query_args );
     96       
     97        //Support new woocommerce_thumbnail image size but keep backwards compatibility
     98        if( in_array( 'woocommerce_thumbnail',  get_intermediate_image_sizes() ) ) {
     99            $sizename = 'woocommerce_thumbnail';
     100        } else {
     101            $sizename = 'shop_thumbnail';
     102        }
    96103
    97104        //If matching product found, check for a thumbnail, otherwise fall back
    98105        if( $product && has_post_thumbnail( $product[0]->ID ) ) {
    99             echo get_the_post_thumbnail( $product[0]->ID, 'shop_thumbnail' );
     106            echo get_the_post_thumbnail( $product[0]->ID, $sizename );
    100107        } else {
    101108            woocommerce_subcategory_thumbnail( $cat );
Note: See TracChangeset for help on using the changeset viewer.