This topic has 15 replies, 4 voices, and was last updated 7 months, 3 weeks ago ago by Andrew Mitchell
Hello, is it possible to remove the image from the subcategories, but not everywhere, we want to leave it in one category. We have a hook that deletes everywhere (remove_action( ‘woocommerce_before_subcategory_title’, ‘woocommerce_subcategory_thumbnail’, 10);) maybe you need to fix it somehow, can you help?
Hello, @Goostaf,
Thank you for contacting us and for using XStore.
We kindly request that you provide a screenshot of the image you wish to have removed from the subcategories. Additionally, please furnish us with the URL of the page where the image should remain in one specific category only.
Thank you for your cooperation and we look forward to hearing from you soon.
Best Regards,
8Theme’s Team
Now, after the hook, the images (screen) are deleted everywhere, but we would like to return them only in the category of one (I throw them into the private section), is this possible?
Dear @Goostaf,
We hope this message finds you well. We would like to suggest using the following custom code to target category ID 135:
add_action('init', 'n2t_init');
function n2t_init(){
if( is_term([135]) ){
remove_action( 'woocommerce_before_subcategory_title', 'woocommerce_subcategory_thumbnail', 10 );
}
}
If it doesn’t help, please provide us with your FTP Account.
We trust that this code will meet your requirements. Should you have any further questions or require additional assistance, please do not hesitate to contact us.
Best Regards,
The 8Theme Team
Alas, for some reason it doesn’t work, I’m dropping the ftp data
Hi @Goostaf,
We’ve created the content-product-cat.php file under /wp-content/themes/xstore-child/woocommerce/ directory.
Also appended this code at the end of this file: https://prnt.sc/bvpDnXnz-FC9
if(is_product_category('multgeroi')) {
remove_action('woocommerce_before_subcategory_title', 'woocommerce_subcategory_thumbnail', 10);
}
Please change multgeroi to another category if you needed.
Best Regards,
The 8Theme Team
I’m sorry, maybe I’m not describing it that way, we need photos to be displayed in the category of Cartoon Characters in all subcategories and that’s it, we don’t need anywhere else. Now I see only one photo in the cartoon in one subcategory, but it is necessary for everyone here, and in other categories it is not necessary to display, in some there are photos
I was probably misunderstood, photos need to be removed everywhere, as I had with the help of a hook, except for subcategories in the category of Cartoon characters, here we need photos
Hi @Goostaf,
Can you confirm that you want to remove all the photos of categories on your website, but keep the photos of sub-categories under multgeroi category?
Thank you!
Here is this hook in function works as it should: remove_action(‘woocommerce_before_subcategory_title’, ‘woocommerce_subcategory_thumbnail’, 10); it removes all thumbnails in all subcategories, but I want to change it so that in multgeroi category these thumbnails are not removed only
Hi @Goostaf,
So please follow the guide on my reply: https://www.8theme.com/topic/is-it-possible-to-remove-images-from-subcategories-but-not-everywhere/#post-392932
But change the code to this:
if(!is_product_category('multgeroi')) {
remove_action('woocommerce_before_subcategory_title', 'woocommerce_subcategory_thumbnail', 10);
}
Hope it helps!
I did, but it does not work correctly, in /multgeroi/ only 1 picture appeared, but in other categories all, I need the opposite, so that nowhere there were no pictures, only in /multgeroi/. I recorded a video
Hi @Goostaf,
Can you confirm that is how you want right now?
Thank you!
Yes, looked in incognito, everything is as it should be, apparently because of the cache I didn’t see it, thank you very much!!!! You are the best
Dear Goostaf,
Choosing our theme reflects your commitment to quality, and for that, we’re genuinely grateful. As we constantly strive to elevate your experience, your feedback is an invaluable gift. Could you kindly take a moment to rate our product with 5 stars on ThemeForest?
Click here to share your insights: https://themeforest.net/downloads
Your support fuels our journey, and we appreciate it more than words can express.
Best Regards,
The 8Theme Team
The issue related to '‘Is it possible to remove images from subcategories, but not everywhere?’' has been successfully resolved, and the topic is now closed for further responses