Home Forums General Issues Include Page in another page


Include Page in another page

  • Hello,

    I’m trying to include a page in another page.
    In my backoffice, I have a field “Post Object” which send the id of the page I want to display in the other page.
    When I try to retrieve the content with get_post, I get the title but the post_content is empty.
    May be it’s because all fields in my content type are handle with ACF ?

    Thanks for your support 🙂

  • Inside your page template you should add another WP_Query to retrieve your subpage data :

    $sub_page = get_field('your_page_field');
    $sub_page_query = new WP_Query('page_id='.$sub_page->ID);
    while( $sub_page_query->have_posts() ) : $sub_page_query->the_post();
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Include Page in another page’ is closed to new replies.