danielbaker
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: [WooCommerce] Category images not showing in product category widgetI have found a way to solve this issue – though it means editing a core file. I am hoping to create a hook/filter to do the same soon.
Basically look for:
plugins/woocommerce/classes/walkers/class-product-cat-list-walker.phpThen on line 62:
function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) { $thumbnail_id = get_woocommerce_term_meta( $object->term_id, 'thumbnail_id', true ); // get category thumbnail id $image = wp_get_attachment_url( $thumbnail_id ); // get image and convert to var $output .= '<li class="cat-item cat-item-' . $object->term_id; if ( $args['current_category'] == $object->term_id ) $output .= ' current-cat'; if ( $args['current_category_ancestors'] && $args['current_category'] && in_array( $object->term_id, $args['current_category_ancestors'] ) ) $output .= ' current-cat-parent'; $output .= '"><a href="' . get_term_link( (int) $object->term_id, 'product_cat' ) . '">' . __( $object->name, 'woocommerce' ) . '<img src="' . $image . '" alt="" /></a>'; // insert category image into link if ( $args['show_count'] ) $output .= ' <span class="count">(' . $object->count . ')</span>'; }Hope this helps.
Viewing 1 replies (of 1 total)