Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $args = array(
- 'post_type' => 'posts',
- 'posts_per_page' => 99,
- 'orderby' => 'parent',
- 'order' => 'ASC'
- );
- $posts = get_posts( $args );
- foreach ( $posts as $post ) {
- $childargs = array(
- 'post_type' => 'posts',
- 'child_of' => $post->ID
- );
- $children = get_pages( $childargs );
- $childcount = count( $children );
- if( $childcount == 0 ) {
- $title = get_the_title( $post->ID );
- echo '<li>' . $title . '</li>';
- }
- } // close foreach
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement