The issue is because you were trying to echo a variable inside a string. Also, if you want to use a custom field in the functions.php file, you need to get it in that file too. It should be something like this:
$backgroundimage = get_field('widget_background_image', 99); register_sidebar( array( 'name' => __( 'Widgets', 'tempestcorp' ), 'id' => 'page-widget', 'description' => __( 'Appears on any of the assigned pages.', 'tempestcorp' ), 'before_widget' => '<section id="%1$s" class="widget %2$s"><div style="background-image: url(' . $backgroundimage['url']; . ');">', 'after_widget' => '</div></section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) );
Where ’99’ is the object ID where the custom fields are located.
If you have the time, please check PHP tutorials here: http://www.w3schools.com/php/.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2023 Advanced Custom Fields.