Jhin Posted October 23, 2023 Share Posted October 23, 2023 Hello, I have in the template blog_posts the field tag_country as InputfieldTextTags field, linked to the pages with template "countries". I know I can safely show how many linked blog_posts to countries i have with: <?php $desired_country = 1; $blog = $pages->find("template=blog_posts, tag_countries=$desired_country"); foreach ($blog as $blogItem) { # loop } ?> But how I can I get only the countries pages that has at least one item tagged? I tries something like this, but I'm feeling I'm missing a huge concept with nested subselectors. <?php $countries = $pages->find("template=countries, [template=blog_posts, tag_country=id].count>=1, include=all"); foreach ($countries as $country) { # loop ?> I hope you can help me, Thank you! ----------------- I found a solution using the owner selector: $countries = $pages->find("template=country_item, parent=$continent, include=all, tag_country.owner.template=blog_posts"); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now