Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. <?php
  2.  
  3. global $post;
  4.  
  5. $exclude = [];
  6. foreach(get_pages(['meta_key' => '_wp_page_template', 'meta_value' => 'guidance-note-template.php']) as $page) {
  7. $exclude[] = $page->post_id;
  8. }
  9.  
  10. $children = get_pages( array( 'child_of' => $post->ID ) );
  11. $hasChild = (count( $children ) > 0 );
  12. $page_id = ($hasChild) ? $post->ID : wp_get_post_parent_id( $post->ID );
  13. wp_list_pages( array(
  14. 'title_li' => '',
  15. 'child_of' => $page_id,
  16. 'exclude' => implode(",", $exclude),
  17. ));
  18. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement