add_setting( 'theme_color' , array( 'default' => '#f61638', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'theme_color', array( 'label' => __( 'Theme Color', 'aisha' ), 'section' => 'colors', 'settings' => 'theme_color', ) ) ); $wp_customize->add_setting( 'links_color' , array( 'default' => '#f61638', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'links_color', array( 'label' => __( 'Links Color', 'aisha' ), 'section' => 'colors', 'settings' => 'links_color', ) ) ); //BLOG SECTION $wp_customize->add_section( 'aisha_blog_customizer_section' , array( 'title' => __( 'Blog', 'aisha' ), 'priority' => 100, 'capability' => 'edit_theme_options', ) ); $wp_customize->add_setting( 'aisha_blog_page_author', array( 'default' => 0, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'aisha_sanitize_checkbox', ) ); $wp_customize->add_control( 'aisha_blog_page_author', array( 'type' => 'checkbox', 'section' => 'aisha_blog_customizer_section', 'label' => __( 'Hide Author from Posts Page', 'aisha' ), 'description' => __( 'Check to hide Author from posts page.', 'aisha' ), ) ); $wp_customize->add_setting( 'aisha_blog_page_category', array( 'default' => 0, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'aisha_sanitize_checkbox', ) ); $wp_customize->add_control( 'aisha_blog_page_category', array( 'type' => 'checkbox', 'section' => 'aisha_blog_customizer_section', 'label' => __( 'Hide Category(ies) from Posts Page', 'aisha' ), 'description' => __( 'Check to hide Category(ies) from posts page.', 'aisha' ), ) ); $wp_customize->add_setting( 'aisha_blog_page_date', array( 'default' => 0, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'aisha_sanitize_checkbox', ) ); $wp_customize->add_control( 'aisha_blog_page_date', array( 'type' => 'checkbox', 'section' => 'aisha_blog_customizer_section', 'label' => __( 'Hide Date from Posts Page', 'aisha' ), 'description' => __( 'Check to hide Date from posts page.', 'aisha' ), ) ); $wp_customize->add_setting( 'aisha_blog_single_page_author', array( 'default' => 0, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'aisha_sanitize_checkbox', ) ); $wp_customize->add_control( 'aisha_blog_single_page_author', array( 'type' => 'checkbox', 'section' => 'aisha_blog_customizer_section', 'label' => __( 'Hide Author from Single Post Page', 'aisha' ), 'description' => __( 'Check to hide Author from single post page.', 'aisha' ), ) ); $wp_customize->add_setting( 'aisha_blog_single_page_category', array( 'default' => 0, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'aisha_sanitize_checkbox', ) ); $wp_customize->add_control( 'aisha_blog_single_page_category', array( 'type' => 'checkbox', 'section' => 'aisha_blog_customizer_section', 'label' => __( 'Hide Category(ies) from Single Post Page', 'aisha' ), 'description' => __( 'Check to hide Category(ies) from single post page.', 'aisha' ), ) ); $wp_customize->add_setting( 'aisha_blog_single_page_date', array( 'default' => 0, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'aisha_sanitize_checkbox', ) ); $wp_customize->add_control( 'aisha_blog_single_page_date', array( 'type' => 'checkbox', 'section' => 'aisha_blog_customizer_section', 'label' => __( 'Hide Date from Single Post Page', 'aisha' ), 'description' => __( 'Check to hide Date from single post page.', 'aisha' ), ) ); //FOOTER $wp_customize->add_section( 'aisha_footer_customizer_section' , array( 'title' => __( 'Footer', 'aisha' ), 'priority' => 101, 'capability' => 'edit_theme_options', ) ); $wp_customize->add_setting( 'aisha_footer_layout', array( 'default' => 'hide', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'aisha_sanitize_select', ) ); $wp_customize->add_control( 'aisha_footer_layout', array( 'type' => 'select', 'section' => 'aisha_footer_customizer_section', 'label' => __( 'Footer Widgets Layout', 'aisha' ), 'description' => __( 'Footer Widgets will show above the bottom copyrights bar.', 'aisha' ), 'choices' => array( 'hide' => __( 'No Footer Widget', 'aisha' ), 'col-md-12' => __( '1 Column', 'aisha' ), 'col-md-6' => __( '2 Columns', 'aisha' ), 'col-md-4' => __( '3 Columns', 'aisha' ), 'col-md-3' => __( '4 Columns', 'aisha' ), ), ) ); //FOOTER $wp_customize->add_section( 'aisha_social_customizer_section' , array( 'title' => __( 'Social Media', 'aisha' ), 'priority' => 102, 'capability' => 'edit_theme_options', ) ); $wp_customize->add_setting( 'aisha_fb_url', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'aisha_sanitize_url', ) ); $wp_customize->add_control( 'aisha_fb_url', array( 'type' => 'url', 'section' => 'aisha_social_customizer_section', 'label' => __( 'Facebook URL', 'aisha' ), 'description' => __( 'Facebook icon will be visible in the bottom footer bar.', 'aisha' ), ) ); $wp_customize->add_setting( 'aisha_twitter_url', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'aisha_sanitize_url', ) ); $wp_customize->add_control( 'aisha_twitter_url', array( 'type' => 'url', 'section' => 'aisha_social_customizer_section', 'label' => __( 'Twitter URL', 'aisha' ), 'description' => __( 'Twitter icon will be visible in the bottom footer bar.', 'aisha' ), ) ); $wp_customize->add_setting( 'aisha_insta_url', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'aisha_sanitize_url', ) ); $wp_customize->add_control( 'aisha_insta_url', array( 'type' => 'url', 'section' => 'aisha_social_customizer_section', 'label' => __( 'Instagram URL', 'aisha' ), 'description' => __( 'Instagram icon will be visible in the bottom footer bar.', 'aisha' ), ) ); $wp_customize->add_setting( 'aisha_youtube_url', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'aisha_sanitize_url', ) ); $wp_customize->add_control( 'aisha_youtube_url', array( 'type' => 'url', 'section' => 'aisha_social_customizer_section', 'label' => __( 'Youtube URL', 'aisha' ), 'description' => __( 'Youtube icon will be visible in the bottom footer bar.', 'aisha' ), ) ); $wp_customize->add_setting( 'aisha_pinterest_url', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'aisha_sanitize_url', ) ); $wp_customize->add_control( 'aisha_pinterest_url', array( 'type' => 'url', 'section' => 'aisha_social_customizer_section', 'label' => __( 'Pinterest URL', 'aisha' ), 'description' => __( 'Pinterest icon will be visible in the bottom footer bar.', 'aisha' ), ) ); $wp_customize->add_setting( 'aisha_gplus_url', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'aisha_sanitize_url', ) ); $wp_customize->add_control( 'aisha_gplus_url', array( 'type' => 'url', 'section' => 'aisha_social_customizer_section', 'label' => __( 'Google+ URL', 'aisha' ), 'description' => __( 'Google+ icon will be visible in the bottom footer bar.', 'aisha' ), ) ); $wp_customize->add_setting( 'aisha_linkedin_url', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'aisha_sanitize_url', ) ); $wp_customize->add_control( 'aisha_linkedin_url', array( 'type' => 'url', 'section' => 'aisha_social_customizer_section', 'label' => __( 'LinkedIn URL', 'aisha' ), 'description' => __( 'LinkedIn icon will be visible in the bottom footer bar.', 'aisha' ), ) ); function aisha_sanitize_checkbox( $checked ) { // Boolean check. return ( ( isset( $checked ) && true == $checked ) ? true : false ); } function aisha_sanitize_select( $input, $setting ) { // Ensure input is a slug. $input = sanitize_key( $input ); // Get list of choices from the control associated with the setting. $choices = $setting->manager->get_control( $setting->id )->choices; // If the input is a valid key, return it; otherwise, return the default. return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } function aisha_sanitize_url( $url ) { return esc_url_raw( $url ); } } add_action( 'customize_register', 'aisha_customize_register' );