add_section('bicycle_rental_general_section', array( 'title' => __('General Settings','bicycle-rental'), 'priority' => 35, )); // Container width $wp_customize->add_setting('bicycle_rental_container_width', array( 'default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'absint', ) ); $wp_customize->add_control('bicycle_rental_container_width', array( 'label' => __( 'Container Size', 'bicycle-rental' ), 'section' => 'bicycle_rental_general_section', 'type' => 'number', 'description' => __('Width in px', 'bicycle-rental') ) ); } add_action( 'customize_register', 'bicycle_rental_customize_register_general' ); // Social Icons function bicycle_rental_customize_register_social( $wp_customize ) { $wp_customize->add_section('bicycle_rental_social_section', array( 'title' => __('Social Icons','bicycle-rental'), 'priority' => 44 , )); $social_networks = array( //Redefinied in Sanitization Function. 'none' => __('-','bicycle-rental'), 'facebook-f' => __('Facebook','bicycle-rental'), 'twitter' => __('Twitter','bicycle-rental'), 'google-plus' => __('Google Plus','bicycle-rental'), 'instagram' => __('Instagram','bicycle-rental'), 'rss fas' => __('RSS Feeds','bicycle-rental'), 'vine' => __('Vine','bicycle-rental'), 'vimeo-v' => __('Vimeo','bicycle-rental'), 'youtube' => __('Youtube','bicycle-rental'), 'flickr' => __('Flickr','bicycle-rental'), ); $social_count = count($social_networks); for ($x = 1 ; $x <= ($social_count - 3) ; $x++) : $wp_customize->add_setting( 'bicycle_rental_social_'.$x, array( 'sanitize_callback' => 'bicycle_rental_sanitize_social', 'default' => 'none' )); $wp_customize->add_control( 'bicycle_rental_social_'.$x, array( 'settings' => 'bicycle_rental_social_'.$x, 'label' => __('Icon ','bicycle-rental').$x, 'section' => 'bicycle_rental_social_section', 'type' => 'select', 'choices' => $social_networks, )); $wp_customize->add_setting( 'bicycle_rental_social_url'.$x, array( 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control( 'bicycle_rental_social_url'.$x, array( 'settings' => 'bicycle_rental_social_url'.$x, 'description' => __('Icon ','bicycle-rental').$x.__(' Url','bicycle-rental'), 'section' => 'bicycle_rental_social_section', 'type' => 'url', 'choices' => $social_networks, )); endfor; function bicycle_rental_sanitize_social( $input ) { $social_networks = array( 'none' , 'facebook-f', 'twitter', 'google-plus-g', 'instagram', 'rss fas', 'vine', 'vimeo-v', 'youtube', 'flickr' ); return in_array($input, $social_networks) ? $input : ''; } } add_action( 'customize_register', 'bicycle_rental_customize_register_social' ); //Header Settings function bicycle_rental_customize_register_header( $wp_customize ) { // Checks if header is disabled function bicycle_rental_header_enabled(){ return get_theme_mod('bicycle_rental_hide_header') == false; } $wp_customize->add_section('bicycle_rental_header_section', array( 'title' => __('Header','bicycle-rental'), 'priority' => 35, )); // Hide header $wp_customize->add_setting( 'bicycle_rental_hide_header' , array( 'default' => false, 'sanitize_callback' => 'bicycle_rental_sanitize_checkbox' ) ); $wp_customize->add_control( 'bicycle_rental_hide_header', array( 'label' => __('Hide the header','bicycle-rental'), 'section' => 'bicycle_rental_header_section', 'settings' => 'bicycle_rental_hide_header', 'type' => 'checkbox', ) ); // Header background color $wp_customize->add_setting('bicycle_rental_header_bg', array( 'default' => '#ffffff', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'bicycle_rental_header_bg', array( 'label' => __('Header background color','bicycle-rental'), 'section' => 'bicycle_rental_header_section', 'active_callback' => 'bicycle_rental_header_enabled', ) ) ); // Header Menu color $wp_customize->add_setting('bicycle_rental_header_menu', array( 'default' => '#eee', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'bicycle_rental_header_menu', array( 'label' => __('Header menu color','bicycle-rental'), 'section' => 'bicycle_rental_header_section', 'active_callback' => 'bicycle_rental_header_enabled', ) ) ); // Header menu color on hover $wp_customize->add_setting('bicycle_rental_header_menu_hover', array( 'default' => '#fff', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'bicycle_rental_header_menu_hover', array( 'label' => __('Header menu color on hover','bicycle-rental'), 'section' => 'bicycle_rental_header_section', 'active_callback' => 'bicycle_rental_header_enabled', ) ) ); // Submenu bg color $wp_customize->add_setting('bicycle_rental_header_submenu_bg_color', array( 'default' => '#ffffff', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'bicycle_rental_header_submenu_bg_color', array( 'label' => __('Submenu background color','bicycle-rental'), 'section' => 'bicycle_rental_header_section', 'active_callback' => 'bicycle_rental_header_enabled', ) ) ); // Submenu color $wp_customize->add_setting('bicycle_rental_header_submenu_color', array( 'default' => '#ffffff', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'bicycle_rental_header_submenu_color', array( 'label' => __('Submenu color','bicycle-rental'), 'section' => 'bicycle_rental_header_section', 'active_callback' => 'bicycle_rental_header_enabled', ) ) ); // Submenu color on hover $wp_customize->add_setting('bicycle_rental_header_submenu_color_hover', array( 'default' => '#ffffff', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'bicycle_rental_header_submenu_color_hover', array( 'label' => __('Submenu menu color on hover','bicycle-rental'), 'section' => 'bicycle_rental_header_section', 'active_callback' => 'bicycle_rental_header_enabled', ) ) ); // Full width Header $wp_customize->add_setting( 'bicycle_rental_full_header' , array( 'default' => false, 'sanitize_callback' => 'bicycle_rental_sanitize_checkbox' ) ); $wp_customize->add_control( 'bicycle_rental_full_header', array( 'label' => __('Full Width Header','bicycle-rental'), 'section' => 'bicycle_rental_header_section', 'settings' => 'bicycle_rental_full_header', 'type' => 'checkbox', 'active_callback' => 'bicycle_rental_header_enabled', ) ); } add_action( 'customize_register', 'bicycle_rental_customize_register_header' ); //Footer Setting function bicycle_rental_customize_register_footer( $wp_customize ) { // Checks if footer is disabled function bicycle_rental_footer_enabled(){ return get_theme_mod('bicycle_rental_hide_footer') == false; } $wp_customize->add_section('bicycle_rental_footer_section', array( 'title' => __('Footer','bicycle-rental'), 'priority' => 150, )); // Hide footer $wp_customize->add_setting( 'bicycle_rental_hide_footer' , array( 'default' => false, 'sanitize_callback' => 'bicycle_rental_sanitize_checkbox' ) ); $wp_customize->add_control( 'bicycle_rental_hide_footer', array( 'label' => __('Hide the footer','bicycle-rental'), 'section' => 'bicycle_rental_footer_section', 'settings' => 'bicycle_rental_hide_footer', 'type' => 'checkbox', ) ); // footer background color $wp_customize->add_setting('bicycle_rental_footer_bg', array( 'default' => '#ffffff', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'bicycle_rental_footer_bg', array( 'label' => __('footer background color','bicycle-rental'), 'section' => 'bicycle_rental_footer_section', 'active_callback' => 'bicycle_rental_footer_enabled', ) ) ); //Footer Text Color $wp_customize->add_setting('bicycle_rental_footer_text', array( 'default' => '#eee', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'bicycle_rental_footer_text', array( 'label' => __('footer text color','bicycle-rental'), 'section' => 'bicycle_rental_footer_section', 'active_callback' => 'bicycle_rental_footer_enabled', ) ) ); // footer link color $wp_customize->add_setting('bicycle_rental_footer_link', array( 'default' => '#eee', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'bicycle_rental_footer_link', array( 'label' => __('footer link color','bicycle-rental'), 'section' => 'bicycle_rental_footer_section', 'active_callback' => 'bicycle_rental_footer_enabled', ) ) ); // footer link color on hover $wp_customize->add_setting('bicycle_rental_footer_link_hover', array( 'default' => '#fff', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'bicycle_rental_footer_link_hover', array( 'label' => __('footer link color on hover','bicycle-rental'), 'section' => 'bicycle_rental_footer_section', 'active_callback' => 'bicycle_rental_footer_enabled', ) ) ); // Full width Footer $wp_customize->add_setting( 'bicycle_rental_full_footer' , array( 'default' => false, 'sanitize_callback' => 'bicycle_rental_sanitize_checkbox' ) ); $wp_customize->add_control( 'bicycle_rental_full_footer', array( 'label' => __('Full Width footer','bicycle-rental'), 'section' => 'bicycle_rental_footer_section', 'settings' => 'bicycle_rental_full_footer', 'type' => 'checkbox', 'active_callback' => 'bicycle_rental_footer_enabled', ) ); } add_action( 'customize_register', 'bicycle_rental_customize_register_footer' );