Support

Account

Home Forums General Issues Add Field to before_widget in functions.php Reply To: Add Field to before_widget in functions.php

  • Okay, so I’ve decided to try a different tactic and am still not getting the background image to appear in the widget.

    $backgroundimage = get_field('widget_background_image', 'widget_' . $widget_id);
    
    	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" style="background-image: url(' . $backgroundimage['url'] . ');">',
    		'after_widget'  => '</section>',
    		'before_title'  => '<h2 class="widget-title">',
    		'after_title'   => '</h2>',
    	) );

    Location Rule:
    Widget = Widget Block Widget

    Inside the widget (Capture.PNG). But still no image. I am left with (Capture2.PNG).

    On top of that, the <section id=””> is stripped.