Echo Child Page & Grandchild Page Count (1 post)

  1. CKemp
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic