Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- global $post;
- $exclude = [];
- foreach(get_pages(['meta_key' => '_wp_page_template', 'meta_value' => 'guidance-note-template.php']) as $page) {
- $exclude[] = $page->post_id;
- }
- $children = get_pages( array( 'child_of' => $post->ID ) );
- $hasChild = (count( $children ) > 0 );
- $page_id = ($hasChild) ? $post->ID : wp_get_post_parent_id( $post->ID );
- wp_list_pages( array(
- 'title_li' => '',
- 'child_of' => $page_id,
- 'exclude' => implode(",", $exclude),
- ));
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement