Home Forums General Issues ACF and one page layout


ACF and one page layout

  • I am creating one page layout theme.

    Idea is to have multiple pages with different custom page templates and display them to the user as one page each page wrapped to its own <section>:

    navigation -> page_navigation.php
    |-first panel -> page_first_panel.php
    |-second panel -> some_other_custom_page_template.php
    |-etc.. -> etc..

    displayed to the user as

    <section id=”navigation”>…</section>
    <section id=”first_panel”>…</section>
    <section id=”second_panel”>…</section>

    and create an custom walker to turn navigation links into anchors.

    I had thought using get_post to get content but this seems problematic. I am using ACF heavily on some of these pages and there are quite many fields on some of them.

    I am rather new to WordPress, any suggestions on how to get multiple pages that use ACF stitched together to display as one page?

    As i understand from is deprecated and get_post only returns values. Using iframes or one long WordPress page with flexible fields instead seem like an non flexible solution.

  • Hi @juhoaj

    Sounds like all you need to do is create multiple pages in the backend of WP. Each page represents a ‘section’.

    Then create a page called ‘Home’ and create a custom page template called ‘home’ for this page to use. Now edit this page template:

    1. Use the WP_Query object to find all pages, then, loop through them.
    2. For each page (post) you loop through, use the $post->ID to find the ACF data.

    Read up on the get_field function to see how you can load data from a specific ID.


Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘ACF and one page layout’ is closed to new replies.