mikhail Posted January 10, 2018 Share Posted January 10, 2018 Hello, Just started w/PW a couple days ago. I am trying to use a category tree I have made to refine the results shown instead of just showing pages with just the one category that was clicked on by the user (unless it is the last category in that branch. I have many images, all using a single "image" template. One image/One Page. Each image page has a field for "location_category" (in addition to numerous other fields for each image) I've created another template "location_category" and made my category tree under that. My menu markup on the front end appears to be working fine, Eg: Locations-> California-> Los Angeles-> Hollywood-> West Hollywood San Diego-> Mission Beach Pacific Beach I am trying to make it so when a user clicks on "California", all images in California are shown in the results, when they click down to Hollywood, then only images for Hollywood and West Hollywood are shown etc. Code I am using now only shows the items in that exact category- $pano_results = $pages->find("location_category=$page, sort=-shoot_date, limit=10"); What are the additional selectors I will need to achieve the above? I am not having much luck finding the precise method because of so many different variations of people's issues with page selects and parents/children. I hope there is a simple method? Thanks Link to comment Share on other sites More sharing options...
Robin S Posted January 10, 2018 Share Posted January 10, 2018 Welcome to the forums @mikhail $page->find() could be useful here. I think something like this should do the trick: // This category plus all child categories under it $categories = $page->find()->prepend($page); $pano_results = $pages->find("location_category=$categories, sort=-shoot_date, limit=10"); 4 Link to comment Share on other sites More sharing options...
mikhail Posted January 11, 2018 Author Share Posted January 11, 2018 this works exactly. Thank you so much! 1 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