I'm no newbie to Views or Argument/Contextual Filters, but I'm having trouble getting my head around a (simple) view.

I've created a Content-type "Event". Which contains an 'Addressfield', which I use to store an Address and Geocode it to an value which I store in Geofield.

What I'm trying to accomplish is a 'related nodes' block, similar to an 'related articles' based on taxonomy. In that case you make a relationship, and use the NID in de URL.

I've created a View: - a block style. - added a 'contextual filter #1': - When Filter value is not available: 'provide default value', content id from URL. - Extra: exclude. This filter excludes the current node.

I'm having trouble getting to the next step: I only want to show the nodes which have the same country as the current node. How do I accomplish that?

So if I'm visiting a node from 'France', I only want to show related nodes from France.

screenshot View content-type full node

1 Answer 1


You can try using PHP code in the contextual filter. You will be able to load the Node using arg(1) - node ID and provide the field value based on the node. Refer screenshot.

Contextual Filter - PHP

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.