Home Forums General Issues Retrieving fields from another page?


Retrieving fields from another page?

  • Hi,
    Would appreciate some help regarding a problem i have.
    Im pretty horrible at this, so its quite possible that im a bit off in what im trying to do here, but i’ll try to explain.

    Im new to a project where they use ACF in a widget to display some user input. A form is created and user can enter input there, and then the input will be displayed in the widget as a sidebar.
    Nothing is stored in a DB; it seems to be stored in an array from ACF.
    All this code is placed in /themes/includes/widgets/widgetname.php

    Now i wanna create a new wordpress page (using page-template) and display the data from the form.
    So i go to my template-page file and try to retrieve the fields from that file.
    I’ve tried to do a $data = get_fields() but $data is false when i var_dump it.
    I guess im missing something obvious here 🙂
    Do i need to export the fields from my widget somehow? And import them in my page?

    Thanks in advance!

  • Via:

    $other_page = 12;
    <p><?php the_field('field_name', $other_page); ?></p>
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.