Home › Support › eCommerce Gem › eC-Gem: Featured Categories – I can't sort categories by id
- This topic has 4 replies, 2 voices, and was last updated 4 years, 6 months ago by
nirav.
-
AuthorPosts
-
September 16, 2020 at 10:03 pm #17003
Anonymous
InactiveGreetings from Turkey 🙂
“eC-Gem: Featured Categories widget” / I can’t sort categories by id
September 17, 2020 at 11:16 am #17008nirav
KeymasterHello Nuslu,
Hope you are doing good!
Unfortunately, the theme does not support the category sorting option. You will need to create the child theme and will need to write the additional code to customize the widget.
Hope this helps!
Have a great day ahead!
Regards,
Team ProDesignsSeptember 17, 2020 at 8:35 pm #17015Anonymous
InactiveThanks you so much 🙂
foreach ( $featured_cats as $term_id => $value ) { $taxonomy = 'product_cat'; $term_details = get_term_by( 'id', $term_id, $taxonomy ); if( !empty( $term_details ) ){ $term_title = $term_details->name; $term_link = get_term_link( $term_id, $taxonomy ); $thumbnail_id = get_term_meta( $term_id, 'thumbnail_id', true ); $image_url = wp_get_attachment_image_src( $thumbnail_id, 'shop_catalog'); if( !empty( $image_url ) ){ $cat_image = $image_url[0]; }else{ $cat_image = wc_placeholder_img_src(); } ?> <li class="product-cat product"> <div class="product-thumb-wrap"> <img src="<?php echo esc_url( $cat_image ); ?>" alt="<?php echo esc_html( $term_title ); ?>"> <?php if( !empty( $view_details ) ){ ?> <div class="add-to-cart-wrap view-details-wrap"> <a href="<?php echo esc_url( $term_link ); ?>" class="button btn-view-details"><?php echo esc_html( $view_details ) ?></a> </div> <?php } ?> </div> <div class="product-info-wrap"> <a href="<?php echo esc_url( $term_link ); ?>"><h4 class="featured-cat-title"><?php echo esc_html( $term_title ); ?><?php if( 1 === $show_counts ){ ?><span class="count"><?php echo ' ('.absint( $term_details->count ).')'; ?></span><?php } ?></h4></a> </div> </li> <?php } }
Can you help with updating this code? if possible 🙂
September 17, 2020 at 9:16 pm #17017Anonymous
InactiveI don’t know how I did it but I did it.
Thank you very much for your support and beautiful theme.
I wish good work. 🙂
September 25, 2020 at 9:58 am #17065nirav
KeymasterHello There!
Hope you are doing good!
We are glad that you did it.
Feel free to get in touch in case of any other query.Have a great weekend ahead!
Regards,
Team ProDesigns -
AuthorPosts
- You must be logged in to reply to this topic.