Home › Forums › General Issues › Add Field to before_widget in functions.php › Reply To: Add Field to before_widget in functions.php
I’m still struggling with this type of issue and am attempting it again. The content posts but not the image still.
Here is my info.
$backgroundimage = get_field('widget_background_image', 'text-2'); register_sidebar( array( 'name' => __( 'Content Bottom 1', 'dvkap' ), 'id' => 'content-bottom', 'description' => __( 'Appears at the bottom of the content on posts and pages.', 'dvkap' ), 'before_widget' => '<section id="%1$s" class="widget %2$s" style="background-image: url(' . $backgroundimage['url'] . ');">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) );
<?php if ( is_active_sidebar( 'content-bottom' ) ): ?> <?php dynamic_sidebar( 'content-bottom' ); ?> <?php endif;?>
Custom field settings (cfsettings.jpg)
Widget screenshot (widget.jpg)
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!
🤔 Curious about the ACF user experience? So are we! Help guide the evolution of ACF by taking part in our first ever Annual Survey and guarantee you’re represented in the results. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 8, 2023
© 2023 Advanced Custom Fields.