Is it possible to remove images from subcategories, but not everywhere?

This topic has 15 replies, 4 voices, and was last updated 6 months, 3 weeks ago ago by Andrew Mitchell

  • Avatar: Goostaf
    Goostaf
    Participant
    April 24, 2024 at 08:53

    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?

    14 Answers
    Avatar: Tony Rodriguez
    Tony Rodriguez
    Support staff
    April 24, 2024 at 09:23

    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

    Avatar: Goostaf
    Goostaf
    Participant
    April 24, 2024 at 13:47

    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?

    Please contact administrator
    for this information.
    Avatar: Justin
    Luca Rossi
    Support staff
    April 25, 2024 at 04:41

    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

    Avatar: Goostaf
    Goostaf
    Participant
    April 25, 2024 at 09:23

    Alas, for some reason it doesn’t work, I’m dropping the ftp data

    Please contact administrator
    for this information.
    Avatar: Justin
    Luca Rossi
    Support staff
    April 25, 2024 at 10:30

    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

    Avatar: Goostaf
    Goostaf
    Participant
    April 25, 2024 at 11:50

    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

    Please contact administrator
    for this information.
    Avatar: Goostaf
    Goostaf
    Participant
    April 25, 2024 at 11:53

    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

    Avatar: Justin
    Luca Rossi
    Support staff
    April 25, 2024 at 13:22

    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!

    Avatar: Goostaf
    Goostaf
    Participant
    April 25, 2024 at 13:37

    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

    Avatar: Justin
    Luca Rossi
    Support staff
    April 26, 2024 at 04:19

    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!

    Avatar: Goostaf
    Goostaf
    Participant
    April 26, 2024 at 09:24

    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

    Please contact administrator
    for this information.
    Avatar: Justin
    Luca Rossi
    Support staff
    April 26, 2024 at 10:27

    Hi @Goostaf,

    Can you confirm that is how you want right now?

    Thank you!

    Please contact administrator
    for this information.
    Avatar: Goostaf
    Goostaf
    Participant
    April 26, 2024 at 10:44

    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

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    April 26, 2024 at 10:44

    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

  • Viewing 15 results - 1 through 15 (of 15 total)

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

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.