Ashley Cameron Design

Ashley Cameron Design

Shop the Creative Design Market

Good morning

Show 2nd & 3rd Level Navigation Together

SnippetsWordPress

About a 1 minute read

"Life is like riding a bicycle. To keep your balance, you must keep moving."

Albert Einstein


1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php global $wp_query;
     $post = $wp_query->post;
     $ancestors = get_post_ancestors($post);
     if( empty($post->post_parent)) {
          $parent = $post->ID;
     } else {
          $parent = end($ancestors);
     }
     if(wp_list_pages("title_li=&child_of=$parent&echo=0")) { ?>
     
     <ul>
          <?php wp_list_pages("title_li=&child_of=$parent&depth=0"); ?>
     </ul>
<?php } ?>