File: /home/bristolfilton.co.uk/public_html/wp-content/themes/skt-pathway/inc/customizer.php
<?php
/**
* SKT Pathway Theme Customizer
*
* @package SKT Pathway
*/
function skt_pathway_customize_register( $wp_customize ) {
//Add a class for titles
class skt_pathway_Info extends WP_Customize_Control {
public $type = 'info';
public $label = '';
public function render_content() {
?>
<h3 style="text-decoration: underline; color: #DA4141; text-transform: uppercase;"><?php echo esc_html( $this->label ); ?></h3>
<?php
}
}
function skt_pathway_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' => '#a0ce4e',
'sanitize_callback' => 'sanitize_hex_color'
));
$wp_customize->add_control(
new WP_Customize_Color_Control($wp_customize,'color_scheme',array(
'label' => __('Color Scheme','skt-pathway'),
'description' => __( '', 'skt-pathway'),
'section' => 'colors',
'settings' => 'color_scheme'
))
);
// Slider Section
$wp_customize->add_section(
'slider_section',
array(
'title' => __('Slider Settings', 'skt-pathway'),
'priority' => null,
'description' => __( 'Featured Image Size Should be ( 1000x434 ) [ This only work when static front page is selected. ]', 'skt-pathway' ),
)
);
$wp_customize->add_setting('page-setting1',array(
'default' => '0',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'skt_pathway_sanitize_integer'
));
$wp_customize->add_control('page-setting1',array(
'type' => 'dropdown-pages',
'label' => __('Select page for slide one:','skt-pathway'),
'section' => 'slider_section'
));
$wp_customize->add_setting('page-setting2',array(
'default' => '0',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'skt_pathway_sanitize_integer'
));
$wp_customize->add_control('page-setting2',array(
'type' => 'dropdown-pages',
'label' => __('Select page for slide two:','skt-pathway'),
'section' => 'slider_section'
));
$wp_customize->add_setting('page-setting3',array(
'default' => '0',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'skt_pathway_sanitize_integer'
));
$wp_customize->add_control('page-setting3',array(
'type' => 'dropdown-pages',
'label' => __('Select page for slide three:','skt-pathway'),
'section' => 'slider_section'
));
$wp_customize->add_setting('hide_slides',array(
'default' => true,
'sanitize_callback' => 'skt_pathway_sanitize_checkbox',
'capability' => 'edit_theme_options',
));
$wp_customize->add_control( 'hide_slides', array(
'settings' => 'hide_slides',
'section' => 'slider_section',
'label' => __('Uncheck This Option To Display Slider','skt-pathway'),
'type' => 'checkbox'
));
// Home Section One
$wp_customize->add_section('homepage_section_one', array(
'title' => __('Home Section One','skt-pathway'),
'description' => __('Select Pages from the dropdown for home section one [ This only work when static front page is selected. ]','skt-pathway'),
'priority' => null
));
$wp_customize->add_setting('page-section1', array(
'default' => '0',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'skt_pathway_sanitize_integer',
));
$wp_customize->add_control( 'page-section1',array('type' => 'dropdown-pages',
'label' => __('','skt-pathway'),
'section' => 'homepage_section_one',
));
$wp_customize->add_setting('hide_section1',array(
'default' => true,
'sanitize_callback' => 'skt_pathway_sanitize_checkbox',
'capability' => 'edit_theme_options',
));
$wp_customize->add_control( 'hide_section1', array(
'settings' => 'hide_section1',
'section' => 'homepage_section_one',
'label' => __('Uncheck This Option To Display This Section','skt-pathway'),
'type' => 'checkbox'
));
//
// Home Section Two
$wp_customize->add_section('homepage_section_two', array(
'title' => __('Home Section Two','skt-pathway'),
'description' => __('Select Pages from the dropdown for home section two [ This only work when static front page is selected. ]','skt-pathway'),
'priority' => null
));
$wp_customize->add_setting('page-section2', array(
'default' => '0',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'skt_pathway_sanitize_integer',
));
$wp_customize->add_control( 'page-section2',array('type' => 'dropdown-pages',
'label' => __('','skt-pathway'),
'section' => 'homepage_section_two',
));
$wp_customize->add_setting('hide_section2',array(
'default' => true,
'sanitize_callback' => 'skt_pathway_sanitize_checkbox',
'capability' => 'edit_theme_options',
));
$wp_customize->add_control( 'hide_section2', array(
'settings' => 'hide_section2',
'section' => 'homepage_section_two',
'label' => __('Uncheck This Option To Display This Section','skt-pathway'),
'type' => 'checkbox'
));
// Homepage Section Three
$wp_customize->add_section('homepage_boxes_section', array(
'title' => __('Home Section Three','skt-pathway'),
'description' => __('Select Pages from the dropdown for homepage four boxes section [ This only work when static front page is selected. ]','skt-pathway'),
'priority' => null
));
$wp_customize->add_setting('page-column1', array(
'default' => '0',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'skt_pathway_sanitize_integer',
));
$wp_customize->add_control( 'page-column1',array('type' => 'dropdown-pages',
'label' => __('','skt-pathway'),
'section' => 'homepage_boxes_section',
));
$wp_customize->add_setting('page-column2', array(
'default' => '0',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'skt_pathway_sanitize_integer',
));
$wp_customize->add_control( 'page-column2',array('type' => 'dropdown-pages',
'label' => __('','skt-pathway'),
'section' => 'homepage_boxes_section',
));
$wp_customize->add_setting('page-column3', array(
'default' => '0',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'skt_pathway_sanitize_integer',
));
$wp_customize->add_control( 'page-column3',array('type' => 'dropdown-pages',
'label' => __('','skt-pathway'),
'section' => 'homepage_boxes_section',
));
$wp_customize->add_setting('hide_boxes',array(
'default' => true,
'sanitize_callback' => 'skt_pathway_sanitize_checkbox',
'capability' => 'edit_theme_options',
));
$wp_customize->add_control( 'hide_boxes', array(
'settings' => 'hide_boxes',
'section' => 'homepage_boxes_section',
'label' => __('Uncheck This Option To Display This Section','skt-pathway'),
'type' => 'checkbox'
));
//end homepage boxes ection
}
add_action( 'customize_register', 'skt_pathway_customize_register' );
//Integer
function skt_pathway_sanitize_integer( $input ) {
if( is_numeric( $input ) ) {
return intval( $input );
}
}
function skt_pathway_custom_css(){
?>
<style type="text/css">
a, .blog_lists h2 a:hover,
#sidebar ul li a:hover,
#footer a:hover, #copyright a:hover,
.sitenav ul li a:hover, .sitenav ul li.current_page_item a,
.postmeta a:hover,
.phoneemail a:hover,#logo h1 span,nav ul li.current-menu-item a, nav ul li a:hover,h1 span, h2 span, h3 span, h4 span, h5 span, h6 span
{ color:<?php echo esc_attr(get_theme_mod('color_scheme','#a0ce4e')); ?>;}
.pagination ul li span.current, .pagination ul li:hover a, .current,
#commentform input#submit:hover,
.wpcf7 input[type='submit'],
.MoreLink:hover,.search-form .search-submit,.pagination ul li span.current, .pagination ul li:hover a,nav ul li ul li.current-menu-item a, nav ul li ul li a:hover, .slide_more a
{ background-color:<?php echo esc_attr(get_theme_mod('color_scheme','#a0ce4e')); ?>;}
.fixed_header{border-bottom-color:<?php echo esc_attr(get_theme_mod('color_scheme','#a0ce4e')); ?>}
nav ul li:hover ul{border-top-color:<?php echo esc_attr(get_theme_mod('color_scheme','#a0ce4e')); ?>}
</style>
<?php
}
add_action('wp_head','skt_pathway_custom_css');
/**
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
*/
function skt_pathway_customize_preview_js() {
wp_enqueue_script( 'skt_pathway_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130508', true );
}
add_action( 'customize_preview_init', 'skt_pathway_customize_preview_js' );
function skt_pathway_custom_customize_enqueue() {
wp_enqueue_script( 'skt-pathway-custom-customize', get_template_directory_uri() . '/js/custom-customize.js', array( 'jquery', 'customize-controls' ), false, true );
wp_localize_script( 'custom-customize', 'custom_customize_vars', array('.accordion-section-title' => __('Upgrade to PRO Version', 'skt-pathway')
));
}
add_action( 'customize_controls_enqueue_scripts', 'skt_pathway_custom_customize_enqueue' );