Hi!
I have page and has 8 children post.
How to display count of child pages? How to output 8?
Dear Alex,
Please use following code. Hope it will help you.
$children = types_get_children();
$number = count( $children );
--
With Regards
Bigul
Hi
Do not quite understand how and where to use it. Could give you an example.
Thank you!
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
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