How to connect two types of content

There are User who has country, and city filed. and Post made by User.
My question is how I can display specific posts based on user filed?

For example, User 1, country: USA, city: New York.( this is a current user)

and i wan to display all posts made by users whose country is same as current user’s country( in this case, USA)
and i want to do this again based on city on different page, displaying all posts made by users whose city is same as current user’s city( in this case, New York)

I dont know how to define a relationship between User and Post.

Can anyone help me to solve this question ?
Thank you in advance.

You can create a relationship between the two by having a field under each Data type that connects to the other. For example:

User
-City
-Country
-List of Posts (type Post)

Post
-User (type User)

Then, when displaying posts made by users you can filter by Posts who’s Users Country or City are a certain location.

1 Like

Thank you for your message telahocomb !
I created new fileds as you said.
but i dont know how to define a Data Source.
How should i define a Data Source to display all posts based on Current User’s country filed or city filed ?

@atage517 you need to use the filtered: Advanced feature

You’ll then be able to filter by This Post’s Author’s Location is in USA

Hope that helps!
Ambroise

Need extra help?

Book a free 15 minutes call - happy to help if I can