Nth child to select CMS items based on CMS field result
This may be a really dumb question, but is it possible to use Nth Child to target a CMS item with a specific field (in this case a switch) within a collection item?
Our work page has a mix of regular work pages (CMS template-based) and case study pages (custom). I have the Work collection set up with a case study switch field that will be toggled on to designate that item as a case study. I'd like to target the state of that field to then style the image wrapper with top radius' of 100v to round the top and differentiate them visually from non-case study pages, as well as change the text color of the project type to blue (see attached).
Is this possible or is there a better way to do this? I had tried Finsweet's CMS Combine with a Work Page collection and a Case Study collection. I've used Nth child to append non-collection items into the CMS list, but when implemented with the combined CMS, it just put everything at the end of the combined list, as well as put all of the case studies after the first collection, and I'd like to have them interspersed with the regular work items.
Here's a link to the site: https://preview.webflow.com/preview/entrust-case-study-2-e3b510e3857353c920?utm_medium=preview_link&utm_source=designer&utm_content=entrust-case-study-2-e3b510e3857353c920&preview=10fcc8961bee865fbcec4cb7231d50a2&pageId=6508b4498dc03bfdca02216e&workflow=preview
TIA!
4 Replies
Update! I've tried another approach using attributes. Here's a screen recording that I did explaining the issue:
https://www.loom.com/share/71827d92172748f5a9b383a5a1c0a6ee?sid=e2afed79-eafd-45bf-b7a7-d5213bcade80
Any help would be greatly appreciated!
Loom
Issues with Coding Skills
Hey, in this video, I discuss some issues I'm facing with coding skills in our website's work section. I explain the difference between work pages and case studies, and how they are differentiated in the CMS collection. I also talk about a field called
Got it figured out so please disregard.
you @Ballen could you set the custom attribute using your CMS field and then target the attribute in your CMS?
oh
I see you figured it out 🙂
great job!
Yep that's what I did! First time using custom attributes and it worked great!