Child page urls link to location on parent page (1 post)

  1. rook
    Posted 2 years ago #

    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: http://rookdesigns.co.uk/web/
    It is a child theme of bootstrapWP.

    any help very much appreciated.

    Harry Rook

Topic Closed

This topic has been closed to new replies.

About this Topic