PHP code example of voceconnect / voce-theme-customizer

1. Go to this page and download the library: Download voceconnect/voce-theme-customizer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

voceconnect / voce-theme-customizer example snippets



add_action( 'customize_register', function( $wp_customize ) {
	$wp_customize->add_section( 'new_section' , array(
		'title'    => 'New Section',
		'priority' => 30,
	) );

	$id = 'new_image';
	$wp_customize->add_setting( $id );
	$wp_customize->add_control( new Voce_Customize_Image_Control( $wp_customize, $id, array(
		'label'    => 'My New Image',
		'settings' => $id,
		'section'  => 'new_section',
	) ) );
} );


add_action( 'customize_register', function( $wp_customize ) {
	$wp_customize->add_section( 'new_section' , array(
		'title'    => 'New Section',
		'priority' => 30,
	) );

	$id = 'new_image';
	$wp_customize->add_setting( $id );
	$wp_customize->add_control( new Voce_Customize_Image_Control( $wp_customize, $id, array(
		'label'         => 'My New Image',
		'settings'      => $id,
		'section'       => 'new_section',
		'output_format' => 'id',
	) ) );
} );


add_action( 'customize_register', function( $wp_customize ) {
	$wp_customize->add_section( 'new_section' , array(
		'title'    => 'New Section',
		'priority' => 30,
	) );

	$id1 = 'new_dropdown';
	$opts = array(
		'val1' => 'Value 1',
		'val2' => 'Value 2',
		'val3' => 'Value 3',
		'val4' => 'Value 4',
	);
	$wp_customize->add_setting( $id1 );
	$wp_customize->add_control( new Voce_Customize_Dropdown_Control( $wp_customize, $id1, array(
		'label'         => 'My New Dropdown',
		'settings'      => $id1,
		'section'       => 'new_section',
		'options'       => $opts,
	) ) );

	$id2 = 'new_textarea';
	$wp_customize->add_setting( $id2 );
	$wp_customize->add_control( new Voce_Customize_Textarea_Control( $wp_customize, $id2, array(
		'label'         => 'My New Textarea',
		'settings'      => $id2,
		'section'       => 'new_section',
	) ) );
} );