J_Szwarga Posted October 24, 2019 Share Posted October 24, 2019 Here's my query: $pages->find("template=collection, sort=-children.count"); However it is sorting my collections based on the total number of children. I've searched all over and cannot find a way to take visibility into account for this property. (I don't want to include any hidden or unpublished children). While rendering the child items in the html, I use $collection->numChildren(true) to show the number of visible, published children. But the sorting is all messed up because it includes all the hidden and unpublished. There's got to be some way to find the count of visible children in an efficient manner, without retrieving every single record to check it with a for loop?? Link to comment Share on other sites More sharing options...
dragan Posted October 24, 2019 Share Posted October 24, 2019 Did you try to add the include parameter in your selector? https://processwire.com/docs/selectors/#access_control 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