Support

Account

Home Forums General Issues How to call ACF fields from my functions.php file Reply To: How to call ACF fields from my functions.php file

  • I managed to solve it and my error was a very basic one.

    I just had to call my field with an ID, such as:

    $title = get_field('title', $post->ID);
    $caption = get_field('caption', $post->ID);

    adding $post->ID in order to be able to reference the template part from anywhere, just because I was pulling this info from a post object.

    For those seeking the same, these have been enlightening links:
    http://www.advancedcustomfields.com/resources/how-to-get-values-from-a-media-attachment/
    http://www.advancedcustomfields.com/resources/how-to-get-values-from-another-page/