Comments Nikolay Todorov started the conversationOctober 5, 2018 at 7:43amI had several problems with the woocommerce categories but managed to solve them. All but one. The category images are not displayed This is what debug shows: Notice: Trying to get property of non-object in /public_html/wp-content/themes/scalia/inc/woocommerce.php on line 363 function scalia_woocommerce_subcategory_thumbnail( $category ) { $small_thumbnail_size = apply_filters( 'single_category_small_thumbnail_size', 'shop_catalog' ); $thumbnail_id = get_woocommerce_term_meta( $category->term_id, 'thumbnail_id', true); $image = ''; if ( $thumbnail_id ) { $image = wp_get_attachment_image_src( $thumbnail_id, $small_thumbnail_size ); $image = $image[0]; } if ( $image ) { $image = str_replace( ' ', '%20', $image ); echo '<img src="' . esc_url( $image ) . '" alt="' . esc_attr( $category->name ) . '" class="img-responsive" />'; } else { echo wc_placeholder_img($small_thumbnail_size); }}[deleted] repliedOctober 5, 2018 at 8:12amHi, Please provide the wp-admin and ftp access. We will try to inspect problem on your site. Also I don't see any problem on this page - https://sitename.org/products Nikolay Todorov replied privately[deleted] repliedOctober 8, 2018 at 7:28amI found an error in content-product_cat.php template on your site. I remove next code: 'woocommerce_template_single_title',from this line: do_action( 'woocommerce_before_subcategory_title','woocommerce_template_single_title', $category );Please check.Nikolay Todorov repliedOctober 8, 2018 at 10:13amThank you.Problem is resolved. Sign in to reply ...
I had several problems with the woocommerce categories but managed to solve them. All but one.
The category images are not displayed
This is what debug shows:
Notice: Trying to get property of non-object in /public_html/wp-content/themes/scalia/inc/woocommerce.php on line 363
function scalia_woocommerce_subcategory_thumbnail( $category ) {
$small_thumbnail_size = apply_filters( 'single_category_small_thumbnail_size', 'shop_catalog' );
$thumbnail_id = get_woocommerce_term_meta( $category->term_id, 'thumbnail_id', true);
$image = '';
if ( $thumbnail_id ) {
$image = wp_get_attachment_image_src( $thumbnail_id, $small_thumbnail_size );
$image = $image[0];
}
if ( $image ) {
$image = str_replace( ' ', '%20', $image );
echo '<img src="' . esc_url( $image ) . '" alt="' . esc_attr( $category->name ) . '" class="img-responsive" />';
} else {
echo wc_placeholder_img($small_thumbnail_size);
}
}
Hi,
Please provide the wp-admin and ftp access. We will try to inspect problem on your site. Also I don't see any problem on this page - https://sitename.org/products
I found an error in content-product_cat.php template on your site. I remove next code:
from this line:
Please check.
Thank you.
Problem is resolved.