digisavvy
3/24/2016 - 5:49 PM

Image upload setting for the customizer

Image upload setting for the customizer

	/**
    * Blog Index (index.php) Settings
    */
	$wp_customize->add_panel(
        'blog_settings_panel', array(
        'priority' => 15,
        'capability' => 'edit_theme_options',
        'theme_supports' => '',
        'title' => __('Blog Index Settings', 'some-like-it-neat'),
        'description' => __('Blog Index related settings and config.', 'some-like-it-neat'),
        )
    );
	$wp_customize->add_section(
        'blog_header_section', array(
        'priority' => 10,
        'capability' => 'edit_theme_options',
        'theme_supports' => '',
        'title' => __('Blog Index Header', 'some-like-it-neat'),
        'description' => '',
        'panel' => 'blog_settings_panel',
        )
    );

    // Blog Index Heading Label
    $wp_customize->add_setting(
        'some_like_it_neat_blog_header_image',
        array(
		'transport'			=> 'refresh',
        'sanitize_callback' => 'esc_raw_url',
        )
    );
	$wp_customize->add_control(
       new WP_Customize_Image_Control(
           $wp_customize,
           'blog_index_header_upload',
           array(
               'label'      => __( 'Upload Blog Index Header Image', 'some-like-it-neat' ),
               'section'    => 'blog_header_section',
               'settings'   => 'some_like_it_neat_blog_header_image',
            //    'context'    => 'your_setting_context'
           )
       )
   );

   $wp_customize->add_setting(
	   'some_like_it_neat_header_text',
	   array(
	   'sanitize_callback'    => 'some_like_it_neat_sanitize_text',
	   'default'            => 'Mummy Sales Blog',
	   'priority'			=> 0
	   )
   );
   $wp_customize->add_control(
	   'some_like_it_neat_header_text',
	   array(
	   'section'    => 'blog_header_section',
	   'label'        => __('Blog Index Title', 'some-like-it-neat'),
	   'type'        => 'text',
	   )
   );