I am watching a wordpress tutorial on Youtube about get_pages() and "child_of":
(from 17'28" to 18'35") https://www.youtube.com/watch?v=GHTZn3atTcM
To check with a page has child(ren) or not, he suggested to use get_pages() with "child_of" to check it. So I created the following category stucture:
About Us - Sub about us // child of about us Contact Us // with no child(ren)
There is 1 post for each category.
And then I put the following into the single.php to check:
$array = get_pages('child_of=' . $post->ID); echo count($array);
Supposed that "About Us" should return 1 as it has a child.
While for "Sub about us" and "Contact Us" should return 0 as both have no child.
But at the end all are returning 0, may I know what am I doing wrong?
Am I misunderstanding how to use get_pages() & "child_of"?
Thanks very much!