Support » Fixing WordPress » Echo Child Page & Grandchild Page Count

  • Hey guys, thanks for considering my issue.

    What I’m trying to do:

    Show count for Child Pages and Grandchild Pages seperately.

    So on a parent page it would something like this:

    Currently 11 child pages and 34 Grandchild pages.

    My code currently:

    $children = get_pages( array(
    'child_of' => $post->ID,
    ) );
    echo count($children);?>

    It displays a count of total children indiscriminately. WordPress docs tell me that it can be modified using “‘parent’ =>” but I haven’t been able to make it work.

    Any suggestions?

    Thanks for your consideration.

  • The topic ‘Echo Child Page & Grandchild Page Count’ is closed to new replies.