• I’m using the following code to add a Select field to the Attributes Row:

    // Add Custom Class Options to SiteOrigin Rows
    add_filter( 'siteorigin_panels_row_style_fields', 'custom_row_style_fields' );
    function custom_row_style_fields($fields) {
    	$row_styles = array(
    		'default-row-style' => 'Choose Style',
    		'row-notification' => 'Notification'
    	);
    		
    	$fields['row_styles'] = array(
    		'name' => __('Row Styles', 'siteorigin-panels'),
    		'type' => 'select',
    		'options' => $row_styles,
    		'group' => 'attributes',
    		'description' => __('Choose a style option for this row of content', 'siteorigin-panels'),
    		'priority' => 1,
    	);
    
    	return $fields;
    }
    
    function custom_row_style_attributes( $attributes, $args ) {
    	if( $args['row_styles'] != 'default-row-style' ) {
    		array_push($attributes['class'], $args['row_styles'] );
    	}
    
    	return $attributes;
    }
    
    add_filter('siteorigin_panels_row_style_attributes', 'custom_row_style_attributes', 10, 2);

    This code is throwing the following error:

    [01-May-2017 13:29:39 UTC] PHP Notice:  Undefined index: row_styles in /xx/xx/xx/wp-content/themes/edmond/functions.php on line 223
    [01-May-2017 13:29:39 UTC] PHP Notice:  Undefined index: row_styles in /xx/xx/xx/wp-content/themes/edmond/functions.php on line 224

    Line 223 is if( $args['row_styles'] != 'default-row-style' ) {
    Line 224 is array_push($attributes['class'], $args['row_styles'] );

    Any ideas why?

The topic ‘Custom Attribute Code for SiteOrigin Row giving Error Message’ is closed to new replies.