PHP code example of vektor-inc / vk-helpers

1. Go to this page and download the library: Download vektor-inc/vk-helpers 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/ */

    

vektor-inc / vk-helpers example snippets


add_action(
	'customize_register',
	function ( $wp_customize ) {
		// HTML control (heading + description).
		$wp_customize->add_setting( 'vk_demo_html', array( 'default' => '' ) );
		$wp_customize->add_control(
			new VK_Custom_Html_Control(
				$wp_customize,
				'vk_demo_html',
				array(
					'label'            => __( 'Demo Section', 'your-textdomain' ),
					'label_tag'        => 'h3',
					'custom_title_sub' => __( 'Sub heading', 'your-textdomain' ),
					'custom_html'      => '<p>Optional explanation HTML.</p>',
					'section'          => 'title_tagline',
				)
			)
		);

		// Text control with number input and "px" suffix.
		$wp_customize->add_setting( 'vk_demo_width', array( 'default' => 100 ) );
		$wp_customize->add_control(
			new VK_Custom_Text_Control(
				$wp_customize,
				'vk_demo_width',
				array(
					'label'        => __( 'Width', 'your-textdomain' ),
					'section'      => 'title_tagline',
					'input_type'   => 'number',
					'input_after'  => 'px',
					'input_attrs'  => array(
						'min'  => 0,
						'max'  => 1000,
						'step' => 1,
					),
				)
			)
		);
	},
	20
);