Show parent page as a link with sub pages in sidebar
-
Currently my sidebars (here’s an example) list the sub pages of the parent that they’re on. However, is there a way to have the parent page listed as a link with the sub pages? So for the link above, the link to the Academy main page would be included above the sub page ‘Life at MCA’. I know I can add the title but I want a link that insertes into the list of sub pages.
Here’s the code I have for the sub pages<?php $output = wp_list_pages('echo=0&depth=1&title_li=' ); if (is_page( )) { $page = $post->ID; if ($post->post_parent) { $page = $post->post_parent; } $children=wp_list_pages( 'echo=0&child_of=' . $page . '&title_li=' ); if ($children) { $output = wp_list_pages ('echo=0&child_of=' . $page . '&title_li='); } } echo $output; ?>
- The topic ‘Show parent page as a link with sub pages in sidebar’ is closed to new replies.