add_section(
'header_section',
array(
'title' => __('Header','butterfly-abode'),
'capability' => 'edit_theme_options',
'description' => __('Allows you to edit your theme\'s layout.','butterfly-abode')
)
);
$wp_customize->add_setting('bfly_logo', array(
'default' => get_stylesheet_directory_uri().'/images/logo.png',
'type' => 'theme_mod',
'sanitize_callback' => 'bfly_sanitize_url',
));
$wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'bfly_logo', array(
'label' => __('Logo Image','butterfly-abode'),
'section' => 'header_section',
'settings' => 'bfly_logo'
)));
$wp_customize->add_setting('bfly_header_text', array(
'default' => ' '. __('Call Us: 1111-0000-2345','butterfly-abode'),
'type' => 'theme_mod',
'sanitize_callback' => 'bfly_sanitize_html'
));
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'header_text', array(
'label' => __('Top Header Text','butterfly-abode'),
'section' => 'header_section',
'settings' => 'bfly_header_text',
'type' => 'textarea'
)));
$wp_customize->add_section(
'slider_section',
array(
'title' => __('Slider','butterfly-abode'),
'capability' => 'edit_theme_options',
'description' => __('To add slides, edit a post and check "Show in Slider" checkbox at the bottom of your post.','butterfly-abode')
)
);
$wp_customize->add_setting('bfly_slider_bg', array(
'type' => 'theme_mod',
'default' => '',
'sanitize_callback' => 'bfly_sanitize_url'
));
$wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'bfly_slider_bg', array(
'settings' => 'bfly_slider_bg',
'label' => __('Slider Background','butterfly-abode'),
'section' => 'slider_section',
)));
$wp_customize->add_section(
'sm_section',
array(
'title' => __('Social Media','butterfly-abode'),
'capability' => 'edit_theme_options',
'description' => __('Allows you to set your social media URLs','butterfly-abode')
)
);
$socials = array('twitter','facebook','google-plus','instagram','pinterest','vimeo','youtube','linkedin');
for($i=0;$iadd_setting('bfly_'.$socials[$i], array(
'capability' => 'edit_theme_options',
'type' => 'theme_mod',
'sanitize_callback' => 'bfly_sanitize_url'
));
$wp_customize->add_control(new WP_Customize_Control($wp_customize, 'bfly_'.$socials[$i], array(
'settings' => 'bfly_'.$socials[$i],
'label' => $name.' URL',
'section' => 'sm_section',
'type' => 'text',
)));
}
$wp_customize->add_section(
'footer_section',
array(
'title' => __('Footer','butterfly-abode'),
'capability' => 'edit_theme_options',
'description' => __('Allows you to set your footer settings','butterfly-abode')
)
);
$wp_customize->add_setting('bfly_copyright', array(
'capability' => 'edit_theme_options',
'type' => 'theme_mod',
'sanitize_callback' => 'bfly_sanitize_html'
));
$wp_customize->add_control(new WP_Customize_Control($wp_customize, 'bfly_copyright', array(
'settings' => 'bfly_copyright',
'label' => __('Copyright Text','butterfly-abode'),
'section' => 'footer_section',
'type' => 'textarea',
)));
}
add_action('customize_register', 'bfly_customize_register');
function bfly_sanitize_html($value){
return wp_filter_post_kses($value);
}
function bfly_sanitize_url($value) {
return esc_url_raw($value);
}
function bfly($name, $default = false) {
return get_theme_mod( $name, $default );
}
?>