get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
//Titles
class Britt_Info extends WP_Customize_Control {
public $type = 'info';
public $label = '';
public function render_content() {
?>
label ); ?>
add_section(
'britt_blog',
array(
'title' => __('Blog', 'britt'),
'priority' => 15,
)
);
$wp_customize->add_setting('britt_options[info]', array(
'type' => 'info_control',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'esc_attr',
)
);
$wp_customize->add_control( new Britt_Info( $wp_customize, 'single_featured', array(
'label' => __('Single posts', 'britt'),
'section' => 'britt_blog',
'settings' => 'britt_options[info]',
'priority' => 10
) )
);
//Featured images
$wp_customize->add_setting(
'single_featured_image',
array(
'default' => 'in-post',
'sanitize_callback' => 'britt_sanitize_single_images',
)
);
$wp_customize->add_control(
'single_featured_image',
array(
'type' => 'radio',
'label' => __('Featured images', 'britt'),
'section' => 'britt_blog',
'description' => __('Featured image display for single posts', 'britt'),
'choices' => array(
'in-post' => __('In post', 'britt'),
'above-post' => __('Above post (recommended only if you have large featured images)', 'britt'),
'none' => __('None', 'britt'),
),
)
);
}
add_action( 'customize_register', 'britt_customize_register' );
/**
* Sanitize
*/
//Featured images
function britt_sanitize_single_images( $input ) {
if ( in_array( $input, array( 'in-post', 'above-post', 'none' ), true ) ) {
return $input;
}
}
/**
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
*/
function britt_customize_preview_js() {
wp_enqueue_script( 'britt_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true );
}
add_action( 'customize_preview_init', 'britt_customize_preview_js' );