All I need is to get a number of children pages of a custom post type This is my query:
$args = array( 'post_parent' => $post->ID, 'post_type' => 'all_products', 'orderby' => 'menu_order' ); $child_query = new WP_Query( $args );
There are some HTML here, and after that, when I need the number of children pages, I have this
<?php while ( $child_query->have_posts() ) : $child_query->the_post(); ?> <?php $children = get_pages( array( 'child_of' => $post->ID, 'parent' => 0, 'post_type' => 'all_products' ) ); $children_num = count( $children ); echo $children_num; ...
After this is executed, I only get 0 If I echo the_permalink(); I get the right link to a child page... Everything seems to be working, only this is the problem
I would appreciate any help or advice. Thanks