Support

Account

Home Forums General Issues ACF and one page layout

Helping

ACF and one page layout

    • juhoaj

    • September 19, 2013 at 4:52 pm

    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>
    etc..

    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 http://codex.wordpress.org/Function_Reference/get_page 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.

    • Elliot

    • September 21, 2013 at 2:22 pm

    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.

    Thanks
    E

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.