Support » Fixing WordPress » Child page urls link to location on parent page

  • rook


    Hello all

    I have set all the content of child pages to display in the parent page using this

        $mypages = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'post_date', 'sort_order' => 'desc' ) );
        foreach( $mypages as $page ) {
            $content = $page->post_content;
            if ( ! $content ) // Check for empty page
            $content = apply_filters( 'the_content', $content );
            <h2><a href="<?php echo get_page_link( $page->ID ); ?>"><?php echo $page->post_title; ?></a></h2>
            <div class="entry"><?php echo $content; ?></div>

    this works fine, what I want to do now is, have it so that when you click on the nav bar subpage link it takes you to the relevant part of the parent page instead of opening a new page. Hope this makes sense.

    Here is a link to the site:
    It is a child theme of bootstrapWP.

    any help very much appreciated.

    Harry Rook

  • The topic ‘Child page urls link to location on parent page’ is closed to new replies.