Home › Forums › WoodMart support forum › different headers for each category in the catalog and in product cards
different headers for each category in the catalog and in product cards
- This topic has 21 replies, 2 voices, and was last updated 4 years ago by
Elise Noromit.
-
AuthorPosts
-
June 21, 2021 at 4:56 pm #301162
loraloraParticipantHi, I had a question about the possibility of using different headers for each category in the catalog and in product cards.
For example, automatically assign header 1 for the dress category and for all products that are included in the dress category with header 1.
And for the category of glasses and all products that belong to the category of glasses, header 2.We have already discussed this topic (see the link) https://xtemos.com/forums/topic/different-header-for-different-parent-categories/ and as far as I understand this function should be added to this update of the topic. But I can’t find it?
Please tell me where can I find this setting?
June 21, 2021 at 11:11 pm #301210
Elise NoromitMemberHello,
Try to add the following PHP code snippet to the child theme functions.php file to do this. Replace ids 10 and 11 with your categories ids and header_576762 with header ids.
add_filter( 'woodmart_get_current_header_id', function ( $id ) { if ( is_product_category() && is_object( get_queried_object() ) ) { if ( get_queried_object()->term_id == 10 ) { return 'header_576762'; } elseif ( get_queried_object()->term_id == 11 ) { return 'header_496420'; } } return $id; } );
Best Regards
June 22, 2021 at 2:13 pm #301459
loraloraParticipantHi yes this works, but only for the parent category. But when you go to a subcategory, the default header is loaded. Also, the header that is specified in this function is not displayed on the product page, but the default header is used.
How can you do so that:
Category1, all subcategories of category 1, all products that are in category 1 and subcategories 1 have a header xx1
Category 2, all subcategories of category 2, all products that fell into category 2 and subcategories 2 had a header xx2?
thanks a lot
June 22, 2021 at 3:33 pm #301480
Elise NoromitMemberHello,
Please delete the code and create the presets for each category: https://gyazo.com/58950d2cc0ee70a500889fed573af890 and set the header in the Theme Settings > General
You can find more details about the presets here: https://xtemos.com/docs/woodmart/faq-guides/woodmart-update-6-0-explained/
If you have any question please feel free to contact
Best Regards
June 22, 2021 at 8:06 pm #301543
loraloraParticipantit’s just amazing! This is the coolest feature of the theme.
Everything works fine for me with header displays in categories and subcategories.
But somehow it doesn’t work on the individual product page.
Please see what am I doing wrong?Attachments:
You must be logged in to view attached files.June 22, 2021 at 10:58 pm #301573
Elise NoromitMemberHello,
The product page has the option just inside the page: https://gyazo.com/ab0f354a10b032d852881ff96c28fce9
If you have any questions please feel free to contact us.
Best Regards
June 23, 2021 at 10:09 am #301723
loraloraParticipantYes, I have already used this function, but I have a multi-vendor, and the supplier himself will load the product from his panel.
Maybe there is some other way to do this automatically?
June 23, 2021 at 3:43 pm #301910
Elise NoromitMemberHello,
Please try to configure the presets in the Theme Settings: https://take.ms/vzbYe
Best Regards
June 24, 2021 at 1:50 pm #302211
loraloraParticipantthis does not work :(((
June 25, 2021 at 10:20 am #302425
Elise NoromitMemberHello,
What theme version do you have now? Please update till 6.1.2 if your version is oder.
Best Regard
June 25, 2021 at 1:30 pm #302527
loraloraParticipantHi, thanks for your support,
I updated the version to the one you specified (for some reason, updates from the console do not work for me and I have to download from themeforest) and made the necessary settings, but for some reason it does not work.June 26, 2021 at 7:50 am #302617
Elise NoromitMemberHello,
Sorry for the inconvenience, what version do you have now? Please update up to 6.1.3 and check.
Best Regards
June 26, 2021 at 12:01 pm #302676
loraloraParticipantHi, I have updated to the latest version, please see the screen.
Can this happen if I am using a child theme?Attachments:
You must be logged in to view attached files.June 26, 2021 at 6:49 pm #302753
Elise NoromitMemberHello,
Yes, deactivate all the plugins not related to the theme, switch the parent theme, and check the issue.
Best Regards
June 26, 2021 at 7:53 pm #302760
loraloraParticipanti did all these steps but it doesn’t work
June 27, 2021 at 6:01 pm #302866
Elise NoromitMemberHello,
Please, provide your site admin access to the private area.
Best Regards
June 28, 2021 at 3:42 pm #303161
loraloraParticipantok
June 28, 2021 at 11:59 pm #303217
Elise NoromitMemberHello,
I have checked the product, I set different headers here only: https://gyazo.com/c1d53f511bace04ddc35d6fab0a28d2b
and it works: https://gyazo.com/87ffa6201a4e64110ca9d82dc3348d0bPlease disable the cache while editing or clear the cache each time.
Best Regards
June 29, 2021 at 11:23 am #303301
loraloraParticipantit only works on one product, the “Мужское” id 233 category.
Moreover, in the same category there are 2 products, and on one product it works (exactly the product the video from which you sent me) and on the other not. Watch the video.Before all the manipulations, I cleared the cache and disabled all plugins from caching.
And I used the same settings for the “Женское” id 232 category, but it doesn’t work at all.
P.S. when saving the rule settings, the page sometimes does not respond due to the total, you have to wait a little
June 29, 2021 at 11:29 am #303304
loraloraParticipanteven now I have deactivated all plugins, except for those who are related to woodmart and woocomerce, but this also does not solve the problem
June 29, 2021 at 12:15 pm #303322
loraloraParticipantThere are small conditions for everything to work:
1. The product card must indicate not only the subcategory, but also the parent category.
2. The settings must contain the settings for the single product page.
I no longer have a question for this thread, you can mark it as resolved.
June 30, 2021 at 8:54 am #303557
Elise NoromitMemberHello,
Please update the site credentials and keep them valid till we solve the issue.
Best Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register