Support

Account

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

  • Warning: Illegal string offset ‘url’ in /home/…/public_html/…/…/…/wp-content/themes/…/functions.php on line 143

    $backgroundimage = get_field('widget_background_image', 'widget_wysiwyg_widgets_widget-11');
    
    	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>',
    	) );