WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm not finding any info on this, so I'm probably wording it incorrectly in my search. So I'm hoping someone can point me in the right direction.

I have 50 pieces of content that'll be going on my wordpress site. Each piece of content will be broken down into 5-6 pages (each). So I made a custom page template for this.

My goal is to have a navigation that shows the child pages, so users can click through them easily to reference different sections of the content. But I don't want to do this manually per page.

I've tried searching for child-page navigations and the best I've come up with is a plugin that just lists the child-pages. This wont work because even on the child pages I want the navigation to show.

Any direction would be extremely helpful.

share|improve this question

I'm outlining a solution for you, it uses get_children to determine if there are any, then conditionally sets up the post id $p_id for the child_of parameter, so that the list of child pages from a certain parent always can be shown, by making use of wp_list_pages().


function wpse125273_child_page_nav() {
    global $post;

    $args = array( 
        'post_parent' => $post->ID,
        'post_type'   => 'page',
        'post_status' => 'publish'
    $children = get_children( $args );

    if ( empty( $children ) ) {
        $p_id = $post->post_parent;
    } else {
        $p_id = $post->ID;

    $args = array(
        'child_of' => $p_id,
        'post_type'   => 'page',
        'post_status' => 'publish'
    wp_list_pages( $args );

Note: exemplary and untested

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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