I'm publishing a course online. The course is written on pages and I need some kind of navigation for the course.

For navigation I want:

  • Previous/next page links
  • A page index

I figure that all the book pages will be subpages (in several levels) to a starting page called "Book". It should be possible to navigate between these with previous/next page. It should also be possible to navigate by clicking on a link in the page index. I imagine that I would show this index either in the sidebar or on each page.

I imagine that the shortcodes could look something like

[previous_page pages_under="/Book" text="<< Previous page"]
[next_page pages_under="/Book" text="Next page >>"]
[pageindex pages_under="/Book" bullets="numbered" hierarchy="indent" current_page_in_pageindex="Make bold and remove link"]

1 Answer 1


This will get you the parent page ID:


..and this will get that parent page's children:


By default that will return an object. You can then play about with that object to your heart's content, including making a navigation of sorts.

Something like this to get started:

    <li class="heading"><?php get_title($post->post_parent); ?></li>

        $children = get_children($post->post_parent);

        foreach($children as $c) {
            echo '<li>'.get_title($c->ID).'</li>';


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.