Home Forums General Issues ACF field in widget doesn't load value


ACF field in widget doesn't load value

  • Hi there,

    I have been experimenting with widgets lately and I tried adding an image field to a widget.
    The field shows up in the customizer but the value doesn’t seem to load. I theorized it could have something to do with including a template inside the widget and adding the ACF fields to that template (I prefer doing it this way as it organises my files better, having the HTML sitting in functions.php like that doesn’t feel… Let’s say “elegant”). Although, when I did add the html to the functions.php directly, I seem to have the same problem.

    Am I missing something?

  • It’s a little bit difficult to find out whre the problem is. Could you spend some code?

  • Off course (as this is just a simple test, I put my css inline):

    <div class="testwidget" style="height: 400px; width: 100%; background-color: blue; background-position: center; background-size: cover; background-image:url('<?php echo get_field( 'widgetbackgroundimage', 'widget_' . $widget_id ); ?>');">
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.