A
A
aDroplet2021-12-27 12:01:07
WordPress
aDroplet, 2021-12-27 12:01:07

How to customize ACF fields in WP?

I have a block with questions on my site, it is repeated on every page.
I brought this block into a separate php file and set up its editing through ACF, and through the include I connect it on those pages where necessary.

When I edit the text in this block on some page, it is only edited for that specific page.
That is, if I have this block on PAGE 1 and on PAGE 2, I edit it in the admin panel on PAGE 1, then the old content will remain on PAGE 2.

The question is how to make it so that when I edit the content of the block on PAGE 1 in the admin panel, the text changes both in this block and on all other pages where this block is connected.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Zolin, 2021-12-27
@artzolin

The function get_field()takes $post_id as the second parameter — the ID of the post from which to take data
get_field($selector, [$post_id], [$format_value]);
. You can also create a general page with site settings https://www.advancedcustomfields.com/resources/opt... , in this case, the option value is passed as the second parameter
the_field( 'header_title', 'option' );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question