M
M
Maxim Vakaev2020-05-25 12:29:53
PHP
Maxim Vakaev, 2020-05-25 12:29:53

How to make it so that you can change the information in header.php and it changes on all pages?

The bottom line is that I have a multi-page site and I need to include a header on all pages. I connect it, I see all the information that is there. But now there was a problem, I need to be able to change it through the advanced custom field plugin, how can I implement this? through the creation of a page where the default template is specified, nothing changes, and if you specify a template for a specific page, it changes only on one.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan Hasanli, 2020-05-25
@dev_max

Hello!
1) If you connect ACF to templates that imply some kind of "globalness" (for example, heade.php & footer.php), then use acf options. For example, you can move theme settings to a separate admin menu item. Then, as the second argument for displaying the acf field, pass option there
. Details - https://www.advancedcustomfields.com/resources/opt... as the second argument for the field, pass the ID of the page for which this custom field was created. - 12 is the ID of the page for which the field was created
<?php the_field('header_title', 'option'); ?>
<?php the_field('header_title', 12); ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question