→ Adding a Customizer Control Image

Let’s create an image field with this package. Type wpC in the Sublime Text and choose wpCustomizerAddControlImage.

The WordPress Customizer snippets outputs the following code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
<?php
// Control: Name.
$wp_customize->add_control( new WP_Customize_Image_Control(
    $wp_customize,
    'prefix_id',
    array(
        'label'      => __( 'Upload an image', 'TEXT_DOMAIN' ),
        'section'    => 'prefix_section_id',
        'settings'   => 'prefix_id',
        'context'    => 'your_setting_context'
    )
) );