Skip to content

Repetitive control for the Theme Customization API of WordPress

Notifications You must be signed in to change notification settings

callbackerror/customize-repeater-control

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

[WordPress] Customize Repeater Control

Repetitive control for the Theme Customization API of WordPress.

Usage:

require_once 'customize-repeater-control.php';

add_action( 'customize_register', 'mytheme_customize_register' );
function mytheme_customize_register( $wp_customize ) {
        $wp_customize->register_control_type('Theme_Customize_Repeater_Control');

	$wp_customize->add_setting( 'mytheme_value_xyz', array(
		'default'        => 'Hello World!',
		'capability'     => 'edit_theme_options',
		'type'           => 'option'
	) );

	$wp_customize->add_control( new Theme_Customize_Repeater_Control( $wp_customize, 'mytheme_value_xyz', array(
		'label'       => __( 'Item', 'mytheme' ),
		'section'     => 'title_tagline',
		'fields'      => array(
			array(
				'key'     => 'key',
				'control' => 'WP_Customize_Control',
				'args'    => array(
					'label' => __( 'Item key', 'mytheme' ),
				)
			),
			array(
				'key'     => 'value',
				'control' => 'WP_Customize_Control',
				'args'    => array(
					'label' => __( 'Item value', 'mytheme' ),
				)
			)
		)
	) ) );
}

About

Repetitive control for the Theme Customization API of WordPress

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 52.1%
  • PHP 47.9%