B
B
Bogdan Oliynik2018-12-15 00:24:27
Layout
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:
5c141ea3a81a9466330930.jpeg
Pages:
5c141eb05ca1a117321243.jpeg
Here is the value of the main page:
5c141ed9cfbc6398806386.jpeg
And here is the Services page:
5c141f07bd4d6682723830.jpeg

Answer the question

In order to leave comments, you need to log in

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

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_страницы ); ?>

O
Orkhan Hasanli, 2018-12-15
@azerphoenix

Hello!
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