Sortable

Kirki Sortable
new \Kirki\Field\Sortable(
	[
		'settings' => 'sortable_setting',
		'label'    => __( 'This is the label', 'kirki' ),
		'section'  => 'section_id',
		'default'  => [ 'option3', 'option1', 'option4' ],
		'priority' => 10,
		'choices'  => [
			'option1' => esc_html__( 'Option 1', 'kirki' ),
			'option2' => esc_html__( 'Option 2', 'kirki' ),
			'option3' => esc_html__( 'Option 3', 'kirki' ),
			'option4' => esc_html__( 'Option 4', 'kirki' ),
			'option5' => esc_html__( 'Option 5', 'kirki' ),
			'option6' => esc_html__( 'Option 6', 'kirki' ),
		],
	]
);

Example of how to load template parts based on the value of the control in a template:

<?php
// Get the parts.
$template_parts = get_theme_mod( 'sortable_setting', array( 'option3', 'option1', 'option4' ) );

// Loop parts.
foreach ( $template_parts as $template_part ) {
	get_template_part( 'partial-templates/' . $template_part );
}

Was this helpful?