Jump to content
Sign in to follow this  
J_Szwarga

Is there a "children.count" property for selectors that accounts for visibility?

Recommended Posts

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??

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...