Support

Account

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

Solving

ACF field in widget doesn't load value

    • roel

    • September 13, 2020 at 7:56 am

    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?

    • tischlr

    • September 15, 2020 at 12:10 am

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

    • roel

    • September 15, 2020 at 6:01 am

    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 ); ?>');">
    </div>
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.