Search code examples
wordpressadvanced-custom-fields

How to add a custom field to my page header


Is there a way to add a custom field to change the image displayed in my web site's header? I want the same imageto be displayed in every page, so I dont know how to make a general custom field instead of a field specific for each page.

<?php
  $img = the_field('background_url'); 
?>

Solution

  • I found a way after reading ACF documentation, in order to make the custom field's scope global, I have to add the post/page ID on it:

    $video_file = get_field('background_video',156);