Skip Navigation

[Closed] How to display count of child pages?

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 10 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

This topic contains 4 replies, has 2 voices.

Last updated by Bigul 10 years, 8 months ago.

Assisted by: Bigul.

Author
Posts
#127826

Hi!
I have page and has 8 children post.
How to display count of child pages? How to output 8?

#127985

Bigul
Supporter

Dear Alex,

Please use following code. Hope it will help you.

$children = types_get_children();
$number = count( $children );

--
With Regards

Bigul

#128021

Hi
Do not quite understand how and where to use it. Could give you an example.
Thank you!

#128049

Bigul
Supporter

Dear Alex,

You have to call it in your theme file, like the following. Normally it will be single.php of theme, it depends upon your theme.

if(get_post_type( get_the_ID() )=="my-post"){
$children = types_get_children();
$number = count( $children );
echo "Child Post Count Is;- ".$number;
}


With Regards

Bigul

#128050

Bigul
Supporter

Dear Alex,

You have to call it in your theme file, like the following. Normally it will be single.php of theme, it depends upon your theme.

if(get_post_type( get_the_ID() )=="my-post"){
$children = types_get_children();
$number = count( $children );
echo "Child Post Count Is :- ".$number;
}


With Regards

Bigul

The topic ‘[Closed] How to display count of child pages?’ is closed to new replies.