Created
April 11, 2017 08:56
-
-
Save ssbalakumar/4693586152460071c5c318bcd87c5d2f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Register colors and layout for the Theme Customizer. | |
*/ | |
function pepper_customize_register($wp_customize) { | |
function pepper_sanitize_text( $input ) { | |
return $input; | |
} | |
function pepper_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'; | |
//Layout Options | |
$wp_customize->add_section('layout_option',array( | |
'title' => __('Layout Option','pepper'), | |
'priority' => 2, | |
)); | |
$wp_customize->add_setting('box_layout',array( | |
'sanitize_callback' => 'pepper_sanitize_checkbox', | |
)); | |
$wp_customize->add_control( 'box_layout', array( | |
'section' => 'layout_option', | |
'label' => __('Check to Box Layout','pepper'), | |
'type' => 'checkbox' | |
)); //Layout Section | |
class pepper_Support extends WP_Customize_Control { | |
public function render_content() { | |
printf( | |
__( 'Hello, Please contact if any changes needed %1$sTekardia%2$s.', 'pepper' ), | |
'<a target="_blank" href="http://www.tekardia.com/contact/">', | |
'</a>' | |
); | |
} | |
} | |
$wp_customize->add_setting('color_scheme',array( | |
'default' => '#02adf4', | |
'sanitize_callback' => 'sanitize_hex_color' | |
)); | |
$wp_customize->add_control( | |
new WP_Customize_Color_Control($wp_customize,'color_scheme',array( | |
'label' => __('Color Scheme','unifield'), | |
// 'description' => __('More color options in PRO Version','pepper'), | |
'section' => 'colors', | |
'settings' => 'color_scheme' | |
)) | |
); | |
$wp_customize->get_section( 'header_image' )->panel = 'pepper_header'; | |
$wp_customize->get_section( 'header_image' )->title = 'Background'; | |
$wp_customize->get_section( 'header_image' )->priority = 5; | |
$wp_customize->add_section('developer_section', array( | |
'title' => __('Who We Are?', 'pepper'), | |
'priority' => 1, | |
)); | |
$wp_customize->add_section('pepper_header_text', array( | |
'priority' => 10, | |
'title' => __('Header Text', 'pepper'), | |
)); | |
$wp_customize->add_section('pepper_footer_text', array( | |
'priority' => 10, | |
'title' => __('Footer Text', 'pepper'), | |
)); | |
$wp_customize->add_setting( 'developer_section_main', array( | |
'sanitize_callback' => 'pepper_sanitize_text' | |
)); | |
$wp_customize->add_control( new pepper_Support( $wp_customize, 'developer_section_main', array( | |
'section' => 'developer_section', | |
))); | |
$wp_customize->add_setting('pepper_header_title', array( | |
'default' => __('We are the best!', 'pepper'), | |
'capability' => 'edit_theme_options', | |
'sanitize_callback' => 'sanitize_text_field' | |
)); | |
$wp_customize->add_control('pepper_header_title', array( | |
'label' => __('Topbar Text', 'pepper'), | |
'section' => 'pepper_header_text', | |
'priority' => 5, | |
'settings' => 'pepper_header_title' | |
)); | |
$wp_customize->add_setting('pepper_header_phone', array( | |
'default' => __('+91 95975 42751', 'pepper'), | |
'capability' => 'edit_theme_options', | |
'sanitize_callback' => 'sanitize_text_field' | |
)); | |
$wp_customize->add_control('pepper_header_phone', array( | |
'label' => __('Phone Number', 'pepper'), | |
'section' => 'pepper_header_text', | |
'priority' => 10, | |
'settings' => 'pepper_header_phone' | |
)); | |
$wp_customize->add_setting('pepper_header_email', array( | |
'default' => __('[email protected]', 'pepper'), | |
'capability' => 'edit_theme_options', | |
'sanitize_callback' => 'sanitize_text_field' | |
)); | |
$wp_customize->add_control('pepper_header_email', array( | |
'label' => __('Email Address', 'pepper'), | |
'section' => 'pepper_header_text', | |
'priority' => 10, | |
'settings' => 'pepper_header_email' | |
)); | |
$wp_customize->add_setting('pepper_footer_left', array( | |
'default' => __('2017 Blank Corp. All rights reserved.', 'pepper'), | |
'capability' => 'edit_theme_options', | |
'sanitize_callback' => 'sanitize_text_field' | |
)); | |
$wp_customize->add_control('pepper_footer_left', array( | |
'label' => __('Email Address', 'pepper'), | |
'section' => 'pepper_footer_text', | |
'priority' => 10, | |
'settings' => 'pepper_footer_left' | |
)); | |
// Calls-to-action Section | |
$wp_customize->add_section( 'cta' , array( | |
'title' => esc_html__( 'Call to Action ', 'pepper' ), | |
'priority' => 70, | |
) ); | |
$wp_customize->add_setting('callto_action_home', array( | |
'default' => __('Hi, this is call to action in home page', 'pepper'), | |
'capability' => 'edit_theme_options', | |
'sanitize_callback' => 'sanitize_text_field' | |
)); | |
$wp_customize->add_control('callto_action_home', array( | |
'label' => __('Callto Actions goes here', 'pepper'), | |
'section' => 'cta', | |
'priority' => 10, | |
'settings' => 'callto_action_home' | |
)); | |
$wp_customize->add_section('social_sec',array( | |
'title' => __('Social Settings','pepper'), | |
'description' => __( 'Add social icons link here. more social icons available in PRO Version', 'pepper' ), | |
'priority' => null | |
)); | |
$wp_customize->add_setting('fb_link',array( | |
'default' => null, | |
'sanitize_callback' => 'esc_url_raw' | |
)); | |
$wp_customize->add_control('fb_link',array( | |
'label' => __('Add facebook link here','pepper'), | |
'section' => 'social_sec', | |
'setting' => 'fb_link' | |
)); | |
$wp_customize->add_setting('twitt_link',array( | |
'default' => null, | |
'sanitize_callback' => 'esc_url_raw' | |
)); | |
$wp_customize->add_control('twitt_link',array( | |
'label' => __('Add twitter link here','pepper'), | |
'section' => 'social_sec', | |
'setting' => 'twitt_link' | |
)); | |
$wp_customize->add_setting('gplus_link',array( | |
'default' => null, | |
'sanitize_callback' => 'esc_url_raw' | |
)); | |
$wp_customize->add_control('gplus_link',array( | |
'label' => __('Add google plus link here','pepper'), | |
'section' => 'social_sec', | |
'setting' => 'gplus_link' | |
)); | |
$wp_customize->add_setting('linked_link',array( | |
'default' => null, | |
'sanitize_callback' => 'esc_url_raw' | |
)); | |
$wp_customize->add_control('linked_link',array( | |
'label' => __('Add linkedin link here','pepper'), | |
'section' => 'social_sec', | |
'setting' => 'linked_link' | |
)); | |
$wp_customize->add_setting('disabled_social',array( | |
'default' => true, | |
'sanitize_callback' => 'pepper_sanitize_checkbox', | |
'capability' => 'edit_theme_options', | |
)); | |
$wp_customize->add_control( 'disabled_social', array( | |
'settings' => 'disabled_social', | |
'section' => 'social_sec', | |
'label' => __('Uncheck To Enable This Section','pepper'), | |
'type' => 'checkbox' | |
));//Disable Slider Section | |
} | |
add_action('customize_register', 'pepper_customize_register'); | |
function pepper_custom_css(){ | |
?> | |
<style type="text/css"> | |
a, .blog_lists h2 a:hover, | |
#sidebar ul li a:hover, | |
.blog_lists h3 a:hover, | |
.cols-4 ul li a:hover, .cols-4 ul li.current_page_item a, | |
.recent-post h6:hover, | |
.fourbox:hover h3, | |
.footer-icons a:hover, | |
.sitenav ul li a:hover, .sitenav ul li.current_page_item a, | |
.postmeta a:hover, | |
.pagebutton:hover | |
{ color:<?php echo esc_html( get_theme_mod('color_scheme','#444')); ?>;} | |
.pagination ul li .current, .pagination ul li a:hover, | |
#commentform input#submit:hover, | |
.nivo-controlNav a.active, | |
.ReadMore, | |
.slide_info .slide_more, | |
.appbutton:hover, | |
h3.widget-title, | |
#sidebar .search-form input.search-submit, | |
.wpcf7 input[type='submit'], | |
#featureswrap | |
{ background-color:<?php echo esc_html( get_theme_mod('color_scheme','#02adf4')); ?>;} | |
</style> | |
<?php | |
} | |
add_action('wp_head','pepper_custom_css'); | |
/** | |
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously. | |
*/ | |
function unifield_customize_preview_js() { | |
wp_enqueue_script( 'unifield_customizer', get_template_directory_uri() . '/js/customize-preview.js', array( 'customize-preview' ), '20161014', true ); | |
} | |
add_action( 'customize_preview_init', 'unifield_customize_preview_js' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment