Current File : /home/wheelch2/public_html/wp-content/themes/building-lite/inc//customizer.php
<?php
/**
* Building Lite Theme Customizer
*
* @package Building Lite
*/
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function building_lite_customize_register( $wp_customize ) {
function building_lite_sanitize_checkbox( $checked ) {
// Boolean check.
return ( ( isset( $checked ) && true == $checked ) ? true : false );
}
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->add_setting('color_scheme', array(
'default' => '#feb62a',
'sanitize_callback' => 'sanitize_hex_color',
));
$wp_customize->add_control(
new WP_Customize_Color_Control($wp_customize,'color_scheme',array(
'label' => __('Color Scheme','building-lite'),
'description' => __('Select color from here.','building-lite'),
'section' => 'colors',
'settings' => 'color_scheme'
))
);
$wp_customize->add_setting('topbar-color', array(
'default' => '#feb62a',
'sanitize_callback' => 'sanitize_hex_color',
));
$wp_customize->add_control(
new WP_Customize_Color_Control($wp_customize,'topbar-color',array(
'description' => __('Select background color for topbar.','building-lite'),
'section' => 'colors',
'settings' => 'topbar-color'
))
);
$wp_customize->add_setting('headerbg-color', array(
'default' => '#ffffff',
'sanitize_callback' => 'sanitize_hex_color',
));
$wp_customize->add_control(
new WP_Customize_Color_Control($wp_customize,'headerbg-color',array(
'description' => __('Select background color for header.','building-lite'),
'section' => 'colors',
'settings' => 'headerbg-color'
))
);
$wp_customize->add_setting('footer-color', array(
'default' => '#2b2b2b',
'sanitize_callback' => 'sanitize_hex_color',
));
$wp_customize->add_control(
new WP_Customize_Color_Control($wp_customize,'footer-color',array(
'description' => __('Select background color for footer.','building-lite'),
'section' => 'colors',
'settings' => 'footer-color'
))
);
// Slider Section Start
$wp_customize->add_section(
'slider_section',
array(
'title' => __('Slider Settings', 'building-lite'),
'priority' => null,
'description' => __('Recommended image size (1420x567). Slider will work only when you select the static front page.','building-lite'),
)
);
$wp_customize->add_setting('page-setting7',array(
'default' => '0',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint'
));
$wp_customize->add_control('page-setting7',array(
'type' => 'dropdown-pages',
'label' => __('Select page for slide one:','building-lite'),
'section' => 'slider_section'
));
$wp_customize->add_setting('page-setting8',array(
'default' => '0',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint'
));
$wp_customize->add_control('page-setting8',array(
'type' => 'dropdown-pages',
'label' => __('Select page for slide two:','building-lite'),
'section' => 'slider_section'
));
$wp_customize->add_setting('page-setting9',array(
'default' => '0',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint'
));
$wp_customize->add_control('page-setting9',array(
'type' => 'dropdown-pages',
'label' => __('Select page for slide three:','building-lite'),
'section' => 'slider_section'
));
$wp_customize->add_setting('hide_slider',array(
'default' => true,
'sanitize_callback' => 'building_lite_sanitize_checkbox',
'capability' => 'edit_theme_options',
));
$wp_customize->add_control( 'hide_slider', array(
'settings' => 'hide_slider',
'section' => 'slider_section',
'label' => __('Check this to hide slider.','building-lite'),
'type' => 'checkbox'
));
// Slider Section End
// Homepage Section Start
$wp_customize->add_section(
'homepage_section',
array(
'title' => __('Homepage Boxes', 'building-lite'),
'priority' => null,
'description' => __('Select pages for homepage boxes. This section will be displayed only when you select the static front page.','building-lite'),
)
);
$wp_customize->add_setting('page-setting1',array(
'default' => '0',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint'
));
$wp_customize->add_control('page-setting1',array(
'type' => 'dropdown-pages',
'label' => __('Select page for first box:','building-lite'),
'section' => 'homepage_section'
));
$wp_customize->add_setting('page-setting2',array(
'default' => '0',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint'
));
$wp_customize->add_control('page-setting2',array(
'type' => 'dropdown-pages',
'label' => __('Select page for second box:','building-lite'),
'section' => 'homepage_section'
));
$wp_customize->add_setting('page-setting3',array(
'default' => '0',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint'
));
$wp_customize->add_control('page-setting3',array(
'type' => 'dropdown-pages',
'label' => __('Select page for third box:','building-lite'),
'section' => 'homepage_section'
));
$wp_customize->add_setting('hide_section',array(
'default' => true,
'sanitize_callback' => 'building_lite_sanitize_checkbox',
'capability' => 'edit_theme_options',
));
$wp_customize->add_control( 'hide_section', array(
'settings' => 'hide_section',
'section' => 'homepage_section',
'label' => __('Check this to hide section.','building-lite'),
'type' => 'checkbox'
));
// Contact Section
$wp_customize->add_section(
'contact_section',
array(
'title' => __('Topbar Info', 'building-lite'),
'priority' => null,
'description' => __('Add your topbar info here.','building-lite'),
)
);
$wp_customize->add_setting('address-txt',array(
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('address-txt',array(
'type' => 'text',
'label' => __('Add address here.','building-lite'),
'section' => 'contact_section'
));
$wp_customize->add_setting('phone-txt',array(
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('phone-txt',array(
'type' => 'text',
'label' => __('Add phone number here.','building-lite'),
'section' => 'contact_section'
));
$wp_customize->add_setting('time-txt',array(
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('time-txt',array(
'type' => 'text',
'label' => __('Add working hours here.','building-lite'),
'section' => 'contact_section'
));
/* ------- Social icons ------- */
$wp_customize->add_setting('facebook',array(
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('facebook',array(
'type' => 'text',
'label' => __('Add facebook link here.','building-lite'),
'section' => 'contact_section'
));
$wp_customize->add_setting('twitter',array(
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('twitter',array(
'type' => 'text',
'label' => __('Add twitter link here.','building-lite'),
'section' => 'contact_section'
));
$wp_customize->add_setting('gplus',array(
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('gplus',array(
'type' => 'text',
'label' => __('Add google plus link here.','building-lite'),
'section' => 'contact_section'
));
$wp_customize->add_setting('linkedin',array(
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('linkedin',array(
'type' => 'text',
'label' => __('Add linkedin link here.','building-lite'),
'section' => 'contact_section'
));
}
add_action( 'customize_register', 'building_lite_customize_register' );
function building_lite_css(){
?>
<style>
a,
.tm_client strong,
.postmeta a:hover,
#sidebar ul li a:hover,
.blog-post h3.entry-title{
color:<?php echo esc_attr(get_theme_mod('color_scheme','#feb62a')); ?>;
}
a.blog-more:hover,
.nav-links .current,
.nav-links a:hover,
#commentform input#submit,
input.search-submit,
.nivo-controlNav a.active,
.blog-date .date,
a.read-more,
.section-box .sec-left a,
.sitenav ul li a:hover,
.sitenav ul li.current_page_item a{
color:<?php echo esc_attr(get_theme_mod('color_scheme','#feb62a')); ?>;
}
h3.widget-title,
.nav-links .current,
.nav-links a:hover{
background-color:<?php echo esc_attr(get_theme_mod('color_scheme','#feb62a')); ?>;
}
.top-header{
background-color:<?php echo esc_attr(get_theme_mod('topbar-color','#feb62a')); ?>;
}
.header{
background-color:<?php echo esc_attr(get_theme_mod('headerbg-color','#ffffff')); ?>;
}
.copyright-wrapper{
background-color:<?php echo esc_attr(get_theme_mod('footer-color','#2b2b2b')); ?>;
}
</style>
<?php }
add_action('wp_head','building_lite_css');
function building_lite_customize_preview_js() {
wp_enqueue_script( 'building-lite-customize-preview', get_template_directory_uri() . '/js/customize-preview.js', array( 'customize-preview' ), '20141216', true );
}
add_action( 'customize_preview_init', 'building_lite_customize_preview_js' );