add_section( 'ct_settings' , array( 'title' => __( 'Theme Settings', 'awork' ), 'priority' => 40, 'description' => '

' . __('1. A full theme demo can be found here', 'awork') . '

', ) ); //Box Header Center $wp_customize->add_setting( 'ct_option[box_header_center]', array( 'default' => 0, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'ct_sanitize_num', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'ct_option[box_header_center]', array( 'label' => __( 'Box Header Center', 'awork' ), 'section' => 'ct_settings', 'type' => 'checkbox', 'priority' => 50, ) ); //Fixed Header $wp_customize->add_setting( 'ct_option[fixed_header]', array( 'default' => 0, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'ct_sanitize_num', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'ct_option[fixed_header]', array( 'label' => __( 'Not Fixed Header', 'awork' ), 'section' => 'ct_settings', 'type' => 'checkbox', 'priority' => 50, ) ); //breadcrumbs $wp_customize->add_setting( 'ct_option[hide_breadcrumbs]', array( 'default' => 0, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'ct_sanitize_num', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'ct_option[hide_breadcrumbs]', array( 'label' => __( 'Hide Breadcrumbs', 'awork' ), 'section' => 'ct_settings', 'type' => 'checkbox', 'priority' => 50, ) ); //Enable Query Loader $wp_customize->add_setting( 'ct_option[enable_query_loader]', array( 'default' => 1, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'ct_sanitize_num', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'ct_option[enable_query_loader]', array( 'label' => __( 'Disabled Query Loader', 'awork' ), 'section' => 'ct_settings', 'type' => 'checkbox', 'priority' => 50, 'description' => '

' . __('For the following options you need to save and to refresh the display change!', 'awork') . '

', ) ); // Theme Options Panel $wp_customize->add_panel( 'awork_homepage_set', array( 'title' => esc_html__( 'Homepage Set', 'awork' ), 'priority' => 60, 'description' => '

' . __('Must enable the Featured Homepage, and set up a Static Front Page, the banner will be displayed!', 'awork') . '

', ) ); /* * HomePage Banner Set */ $wp_customize->add_section('ct_homepage_banner' , array( 'title' => esc_html__('HomePage Banner', 'awork'), 'panel' => 'awork_homepage_set', 'priority' => 120, )); //homepage banner images // ============================= // = Image Upload = // ============================= $wp_customize->add_setting('ct_option[homepage_banner_img]', array( 'default' => get_stylesheet_directory_uri().'/images/banner1.jpg', 'sanitize_callback' => 'ct_sanitize_url', 'capability' => 'edit_theme_options', 'type' => 'option', )); $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'homepage_banner_img', array( 'label' => __('Homepage Banner Image:', 'awork'), 'section' => 'ct_homepage_banner', 'settings' => 'ct_option[homepage_banner_img]', ))); // $wp_customize->add_setting( 'ct_option[homepage_banner_button_url]', array( 'default' => __('#', 'awork'), 'sanitize_callback' => 'ct_sanitize_url', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_option[homepage_banner_button_url]', array( 'label' => __( 'Homepage Banner Button Url:', 'awork' ), 'section' => 'ct_homepage_banner', 'settings' => 'ct_option[homepage_banner_button_url]', 'type' => 'url', ) ); //homepage banner H1 $wp_customize->add_setting( 'ct_option[homepage_banner_text_h1]', array( 'default' => __('Awork One Page Full Screen', 'awork'), 'sanitize_callback' => 'ct_sanitize_textarea', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_option[homepage_banner_text_h1]', array( 'label' => __( 'Homepage Banner Text H1:', 'awork' ), 'section' => 'ct_homepage_banner', 'settings' => 'ct_option[homepage_banner_text_h1]', 'type' => 'textarea', ) ); //homepage banner text $wp_customize->add_setting( 'ct_option[homepage_banner_text]', array( 'default' => __('Awesome one-page full screen WordPress theme. Support home page slides, and video background too.', 'awork'), 'sanitize_callback' => 'ct_sanitize_textarea', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_option[homepage_banner_text]', array( 'label' => __( 'Homepage Banner Text:', 'awork' ), 'section' => 'ct_homepage_banner', 'settings' => 'ct_option[homepage_banner_text]', 'type' => 'textarea', ) ); //homepage banner text $wp_customize->add_setting( 'ct_option[homepage_banner_button_text]', array( 'default' => __('Download Now', 'awork'), 'sanitize_callback' => 'ct_sanitize_textarea', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_option[homepage_banner_button_text]', array( 'label' => __( 'Homepage Banner Button Text:', 'awork' ), 'section' => 'ct_homepage_banner', 'settings' => 'ct_option[homepage_banner_button_text]', 'type' => 'textarea', ) ); /* * HomePage contact_us Set */ $wp_customize->add_section('ct_homepage_contact_us' , array( 'title' => esc_html__('HomePage Contact Us Set', 'awork'), 'panel' => 'awork_homepage_set', 'priority' => 120, )); //homepage Contact Us ttitle $wp_customize->add_setting( 'ct_option[homepage_contact_us_title]', array( 'default' => __('Contact Us', 'awork'), 'sanitize_callback' => 'ct_sanitize_textarea', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_option[homepage_contact_us_title]', array( 'label' => __( 'Homepage Contact Us Title:', 'awork' ), 'section' => 'ct_homepage_contact_us', 'settings' => 'ct_option[homepage_contact_us_title]', 'type' => 'text', ) ); //homepage Contact Us text $wp_customize->add_setting( 'ct_option[homepage_contact_us_text]', array( 'default' => __('Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere.', 'awork'), 'sanitize_callback' => 'ct_sanitize_textarea', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_option[homepage_contact_us_text]', array( 'label' => __( 'Homepage Contact Us Text:', 'awork' ), 'section' => 'ct_homepage_contact_us', 'settings' => 'ct_option[homepage_contact_us_text]', 'type' => 'textarea', ) ); //homepage Contact Us email $wp_customize->add_setting( 'ct_option[homepage_contact_us_email]', array( 'default' => get_bloginfo( 'admin_email'), 'sanitize_callback' => 'ct_sanitize_textarea', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_option[homepage_contact_us_email]', array( 'label' => __( 'Contact Us Email:', 'awork' ), 'section' => 'ct_homepage_contact_us', 'settings' => 'ct_option[homepage_contact_us_email]', 'type' => 'email', ) ); //homepage Contact Us phone $wp_customize->add_setting( 'ct_option[homepage_contact_us_phone]', array( 'default' => __('+123456789', 'awork'), 'sanitize_callback' => 'ct_sanitize_textarea', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_option[homepage_contact_us_phone]', array( 'label' => __( 'Homepage Contact Us Phone:', 'awork' ), 'section' => 'ct_homepage_contact_us', 'settings' => 'ct_option[homepage_contact_us_phone]', 'type' => 'text', ) ); //homepage Contact Us Website $wp_customize->add_setting( 'ct_option[homepage_contact_us_website]', array( 'default' => __('www.coothemes.com', 'awork'), 'sanitize_callback' => 'ct_sanitize_textarea', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_option[homepage_contact_us_website]', array( 'label' => __( 'Homepage Contact Us Website:', 'awork' ), 'section' => 'ct_homepage_contact_us', 'settings' => 'ct_option[homepage_contact_us_website]', 'type' => 'text', ) ); //homepage Contact Us Address $wp_customize->add_setting( 'ct_option[homepage_contact_us_address]', array( 'default' => __('130 W San Bernardino Rd.', 'awork'), 'sanitize_callback' => 'ct_sanitize_textarea', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_option[homepage_contact_us_address]', array( 'label' => __( 'Homepage Contact Us Address:', 'awork' ), 'section' => 'ct_homepage_contact_us', 'settings' => 'ct_option[homepage_contact_us_address]', 'type' => 'textarea', ) ); //contact $wp_customize->add_setting('ct_option[homepage_contact_img]', array( 'default' => get_stylesheet_directory_uri().'/images/contact-us.png', 'sanitize_callback' => 'ct_sanitize_url', 'capability' => 'edit_theme_options', 'type' => 'option', )); $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'homepage_contact_img', array( 'label' => __('Homepage Contact Background Image:', 'awork'), 'section' => 'ct_homepage_contact_us', 'settings' => 'ct_option[homepage_contact_img]', ))); } add_action( 'customize_register', 'ct_customize_register' ); function ct_sanitize_url( $value ) { $value = esc_url_raw( $value); return $value; } function ct_sanitize_num( $value) { if ( ! $value || is_null($value) ) return $value; $value = esc_attr( $value); // clean input $value = (int) $value; // Force the value into integer type. return ( 0 < $value ) ? $value : null; } function ct_sanitize_textarea( $str ) { return wp_kses_post($str); } function ct_sanitize_decimal_num( $value) { if ( ! $value || is_null($value) ) return $value; $value = esc_attr( $value); // clean input return ( 0 < $value ) ? $value : null; } function ct_sanitize_hex_color( $color ) { if ( $unhashed = sanitize_hex_color_no_hash( $color ) ) return '#'.$unhashed; return '#'.$color; }