I want to add advanced custom fields/custom fields to my header.php as it contains text and phone numbers that we may change - I have tried referencing them but it didn't work. I have also Googled and not found a solution yet.

I want to be able to edit the content of the fields from my home page, so I am thinking that might be what I am doing wrong?

When I reference the advanced custom fields at the top of my header page in Adobe brackets, the colour of the code doesn't change so I am guessing it isn't allowed there.

Would I set something up in functions.php ?

EDIT: Adding code example - I have a few fields to add but obvs just need to get one right. As I mentioned, cannot add ref to ACF in the file as you normally do, it doesn't work the same.

  <div class="pull-right hidden-sm">

 <h3>Recruitment: <a href="tel:<?php echo $recruitment_number_ctc; ?>"><?php echo $recruitment; ?></a></h3>
  • Please can you write the code in details
    – Tarun modi
    Apr 27, 2017 at 8:58

1 Answer 1


Can you put the following code for displaying content of custom filed?

<?php the_field('filed_name'); ?>
  • Will try that now...
    – Tracy
    Apr 27, 2017 at 9:35
  • OMG - that worked....awesome :) :) :) cheers very much!
    – Tracy
    Apr 27, 2017 at 9:36
  • So you can now see your content right?
    – Tarun modi
    Apr 27, 2017 at 9:40
  • Yes, it's all working great, love it!
    – Tracy
    Apr 27, 2017 at 9:43
  • It's only displaying on the home page as that's where I added them. I can't add a rule to the custom fields for that page or they will apply across all pages. How do I get the custom field to be global in the header?
    – Tracy
    Apr 27, 2017 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.