Contextual filters react to what is displayed in the URL, hidden or not. So you can show all the other nodes of a content type while you are watching a particular node. A system that is widely used in online shops to display other products.
The view that is being filtered can be coupled to the content type by means of a 'viewfield' or of an 'EVA' (i refer to the modules thereabout).
What if you want to see, when watching a node, all other nodes that have the same taxonmyterm . This may even with multiple content types.
We see a picture (node) here. Beneath this picture the other nodes are displayed (with a photo) of the same category (portrait). There are also pictures of other categories (nature, construction, ...) but these are not shown. You can create a separate view for every taxonomy term, but this is not necessary with contextual filters.
We first set the view and choose the fields that we wish.
Then we go to the contextual filters
We filter out the category. We use the term ID. You can test this by moving the mouse over the term. This number is the ID.
You will now have all the nodes of the same category, even those where you look at that particular moment. Not good.
Therefore, we filter the current node away from the view.
OK. add the view a content type. First I use viewfield.
And I always choose the same view. Important is the argument passed to the URL. Our view looks at the term id (tid) Therefore, we must also set this in the field setting.
Now everything works as it should. I will now discuss the procedure as you would use an EVA field.
Link it to the content type
and set the argument. Again, you have to link to the view with the tid.
Yep. Same result as in view field.