Advanced Custom Fields into functions.php

I’m trying to include a few custom fields I’ve created in my functions.php file so they’re native to the theme I’m working on. However they’re not showing up on the edit screens of the posts I’ve set them to.

I’ve included the acf plugin in my theme by using this code in my functions.php: include_once(‘advanced-custom-fields/acf.php’);

I also exported the fields to php and copy and pasted the code in the functions.php of my theme. Can anyone tell me what I’m doing wrong?

2 Answers
2

Check that ACF included in your theme, if not than include acf. Try to use following code:

if( !class_exists('Acf') )
    include_once get_stylesheet_directory_uri() . '/advanced-custom-fields/acf.php' );

Leave a Comment