ankh2054 Posted May 30, 2014 Posted May 30, 2014 Hi all, I am trying to count the child pages of the current page, but Im doing something wrong and I don't quite understand what that is. $total = $pages->count("$page->children"); I have also tried the following $total = $pages->count($page->children); could someone help please
ankh2054 Posted May 30, 2014 Author Posted May 30, 2014 Found another way, but would be interested to know how it would work the other way. <? echo count($page->children) ?>
teppo Posted May 30, 2014 Posted May 30, 2014 $pages->count() is used to count pages matching given selector string, such as $pages->count("template=basic-page"). $page->children returns children of given page (PageArray object), not a selector string. You can also use built-in property "numChildren": <?php echo $page->numChildren; ?> 1
WillyC Posted May 30, 2014 Posted May 30, 2014 $page->numChildren includar.hidden y unpublishado .. alos.s u have $page->numVisibleChildren 3
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