I have a hierarchical taxonomy vocabulary, “Living Things”. A simplified excerpt looks like this:
Plants
--Roses
----Red Rose
----Pink Rose
--Orchids
----White Orchid
----Yellow Orchid
I have a library of media (images and videos) that have a field, “Primary Taxon”, which references the appropriate term in that “Living Things” vocabulary. e.g. An image of various roses has its “Primary Taxon” field set to “Roses”, and a video of a white orchid has its “Primary Taxon” field set to “White Orchid”.
On my taxonomy term pages, how can I display all media that references that species, and that species’ immediate children? i.e. The “Roses” page should show media that displays roses in general, as well as red roses and pink roses. The “Plants” page should show media that displays plants in general, as well as roses in general, and orchids in general, but not the individual species.
Ideally, it should also be possible to sort the view with either “this taxon first”, or “children first”, but I’m interested in any solution without this functionality too.
So far, I have made a view that shows all media on the taxonomy pages. However I can’t find an appropriate contextual filter to limit the displayed media. Even a single contextual filter using “Media: Primary Taxon (field_primary_taxon)” stops any media from displaying.