• Resolved ThemeAWESOME

    (@tsquez)


    This is what i am using:

    xxxxxx_Kirki::add_field('theme_customizer',array(
    	'type'        => 'spacing',
    	'settings'    => 'inside_top_sidebar_padding',
    	'label'       => __('Spacing Control', 'my_textdomain'),
    	'tooltip'     => esc_attr__('Set the amount of padding in the inner Top SideBar container. You can use PX, %, REM, and EM based values. Default is 10px.','themepress-primo'),
    	'section'     => 'top_sidebar_layout_section',
    	'priority'    => 4,
    	'transport'   => 'auto',
    	'default'     => array(
    		'top'    => '10px',
    		'right'  => '10px',
    		'bottom' => '10px',
    		'left'   => '10px',
    	),
    	'output'      => array(
    		array(
    			'element' => '.inside-top-sidebar',
    			'function' => 'css',
    			'property' => 'padding-top,padding-right,padding-bottom,bottom-left',
    		),
    	),
    ) );

    and I get this error:

    Warning: Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/forge/wp-content/plugins/kirki/modules/css/field/class-kirki-output-field-dimensions.php on line 34

    So I suppose I did not build it correctly….lol

    Any help to get this to work would be appreciated – would actually be cool if there was an full working example on the Spacing page. I know there is one there, but I don’t think it’s complete.

    • This topic was modified 7 years, 5 months ago by ThemeAWESOME.
    • This topic was modified 7 years, 5 months ago by ThemeAWESOME.
    • This topic was modified 7 years, 5 months ago by ThemeAWESOME.
Viewing 5 replies - 1 through 5 (of 5 total)
  • 
    xxxxxx_Kirki::add_field('theme_customizer',array(
    	'type'        => 'spacing',
    	'settings'    => 'inside_top_sidebar_padding',
    	'label'       => __('Spacing Control', 'my_textdomain'),
    	'tooltip'     => esc_attr__('Set the amount of padding in the inner Top SideBar container. You can use PX, %, REM, and EM based values. Default is 10px.','themepress-primo'),
    	'section'     => 'top_sidebar_layout_section',
    	'priority'    => 4,
    	'transport'   => 'auto',
    	'default'     => array(
    		'top'    => '10px',
    		'right'  => '10px',
    		'bottom' => '10px',
    		'left'   => '10px',
    	),
    	'output'      => array(
    		array(
    			'element' => '.inside-top-sidebar',
    			'property' => 'padding',
    		),
    	),
    ) );
    
    Thread Starter ThemeAWESOME

    (@tsquez)

    Tried that but still get the error and the spacing box doesn’t even show

    Thread Starter ThemeAWESOME

    (@tsquez)

    So any ideas on what is wrong? I’m using 4.8.2.

    As I stated previously, I tried what you suggested above and still got the error

    I’m unable to replicate this.

    You mentioned that the error you’re getting is this:

    Warning: Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/forge/wp-content/plugins/kirki/modules/css/field/class-kirki-output-field-dimensions.php on line 34

    That line is foreach ( $value as $key => $sub_value ) { so the only thing that could have caused this error is if the value is not formatted as an array but instead as a string.
    Did you by any chance use another control type for the inside_top_sidebar_padding setting in the past?
    If so that would explain things since the setting is not saved in a format that the control can accept.
    Try changing the setting-same, that should fix the error.

    Thread Starter ThemeAWESOME

    (@tsquez)

    Why yes i did sir…wow you are good. I was using the dimension control before but wanted to switch it to give users more control.

    I Will try this tomorrow when i get home.

    Thanks again.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to get Spacing control to work’ is closed to new replies.