Bogdan Oliynik2018-12-15 00:24:27
Bogdan Oliynik, 2018-12-15 00:24:27

advanced custom fields. How to make the value of the fields set on one custom page displayed on others without re-entering them?

Yes, I read the doc on the official website and watched the video, but I don’t understand how to do it right, and there are no such examples on the Internet that I need, can someone explain how this can be implemented?
Here is what I have so far:
Field groups:
Here is the value of the main page:
And here is the Services page:

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Denis Yanchevsky, 2018-12-15

In the_field and get_field specify the page ID as the second parameter. For example, if the field values ​​are specified for the main page, then the ID of the main page.

$value = get_field( "text_field", ID_страницы );

<?php the_field( 'text_field', ID_страницы ); ?>

Orkhan Hasanli, 2018-12-15

Given that the footer, header and sidebar are "common" areas, it would be more logical to use acf_option.
Create a menu item "Theme Options" and display settings in the right places via the_field || get_field adding 'option'
And so, of course, you can just pass the ID of the page for which you chose to display custom fields. Those. if you load them on the main page, then pass the id of the main page to the custom fields and, accordingly, they will be available for other pages

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question