kirki icon indicating copy to clipboard operation
kirki copied to clipboard

background. The background picture is not correctly set

Open auerserg opened this issue 9 years ago • 2 comments

Issue description:

The "background" does not work correctly, if in section 2 of the element. When you select an image, the image for the last item is set.

Version used:

3.0.0-beta.1 #af820c6bbce02ebe4ef27727f84f3c5cc0e0a4c3

Using theme_mods or options?

theme_mods

Code to reproduce the issue (config + field(s))

Kirki::add_field( 'global', array(
	'type'			 => 'background',
	'settings'		 => 'general_website_background',
	'label'			 => __( 'Website Background', 'kirki' ),
	'description'	 => __( 'Background outside the content area if boxed layout is selected', 'kirki' ),
	'section'		 => 'global_background_settings',
	'default'		 => array(
		'color'		 => '#ffffff',
		'image'		 => '',
		'repeat'	 => 'no-repeat',
		'size'		 => 'cover',
		'attach'	 => 'fixed',
		'position'	 => 'left-top',
		'opacity'	 => 90,
	),
	'priority'		 => 10,
	'output'		 => 'body, .site-content',
) );

Kirki::add_field( 'global', array(
	'type'			 => 'background',
	'settings'		 => 'general_boxed_website_background',
	'label'			 => __( 'Boxed Layout Content Background', 'kirki' ),
	'description'	 => __( 'Content area background for boxed layout.', 'kirki' ),
	'section'		 => 'global_background_settings',
	'default'		 => array(
		'color'		 => '#ffffff',
		'image'		 => '',
		'repeat'	 => 'no-repeat',
		'size'		 => 'cover',
		'attach'	 => 'fixed',
		'position'	 => 'left-top',
		'opacity'	 => 90,
	),
	'priority'		 => 10,
	'output'		 => 'body.layout-boxed .site-content',
) );

auerserg avatar May 24 '17 12:05 auerserg

Good catch 👍 I believe that last commit fixed the issue, can you please verify? Thanks!

aristath avatar May 27 '17 15:05 aristath

by the way, the defaults and output are not properly set in your code above. That was an old syntax that was used about 2 years ago. The new background field in version 3.0 requires this:

Kirki::add_field( 'global', array(
	'type'        => 'background',
	'settings'    => 'general_boxed_website_background',
	'label'       => __( 'Boxed Layout Content Background', 'kirki' ),
	'description' => __( 'Content area background for boxed layout.', 'kirki' ),
	'section'     => 'theme_options',
	'default'     => array(
		'background-color'    => '#ffffff',
		'background-image'    => '',
		'background-repeat'   => 'no-repeat',
		'background-size'     => 'cover',
		'background-attach'   => 'fixed',
		'background-position' => 'left-top',
		'background-opacity'  => 90,
	),
	'priority'		 => 10,
	'output'		 => array(
		array(
			'element' => 'body.layout-boxed .site-content',
		),
	),
) );

And also you should not use the global config in a project, instead you should define your own as per the instructions on https://aristath.github.io/kirki/docs/getting-started/config.html

aristath avatar May 27 '17 23:05 aristath