Support

Account

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

  • Thank you, James.

    Taking your advice, I’m experiencing this error:

    Parse error: syntax error, unexpected ';', expecting ')' in /home/tempestus/public_html/wp-content/themes/xxxxxx/functions.php on line 137

    My code (line 137 is the ‘before_widget’ code):

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