add_section( 'blackcolors_typography', array( 'title' => __('Fonts', 'blackcolors' ), 'priority' => 15, ) ); $font_choices = array( 'Fira Sans:400,700,400italic,700italic' => 'Fira Sans', 'Merriweather:900,700' => 'Merriweather', 'Source Sans Pro:400,700,400italic,700italic' => 'Source Sans Pro', 'Droid Sans:400,700' => 'Droid Sans', 'Lato:400,700,400italic,700italic' => 'Lato', 'Arvo:400,700,400italic,700italic' => 'Arvo', 'Lora:400,700,400italic,700italic' => 'Lora', 'PT Sans:400,700,400italic,700italic' => 'PT Sans', 'PT+Sans+Narrow:400,700' => 'PT Sans Narrow', 'Arimo:400,700,400italic,700italic' => 'Arimo', 'Ubuntu:400,700,400italic,700italic' => 'Ubuntu', 'Bitter:400,700,400italic' => 'Bitter', 'Droid Serif:400,700,400italic,700italic' => 'Droid Serif', 'Open+Sans:400italic,700italic,400,700' => 'Open Sans', 'Roboto:400,400italic,700,700italic' => 'Roboto', 'Oswald:400,700' => 'Oswald', 'Open Sans Condensed:700,300italic,300' => 'Open Sans Condensed', 'Roboto Condensed:400italic,700italic,400,700' => 'Roboto Condensed', 'Raleway:400,700' => 'Raleway', 'Roboto Slab:400,700' => 'Roboto Slab', 'Yanone Kaffeesatz:400,700' => 'Yanone Kaffeesatz', 'Rokkitt:400' => 'Rokkitt', ); $wp_customize->add_setting( 'blackcolors_body_fonts', array( 'sanitize_callback' => 'blackcolors_sanitize_fonts', ) ); $wp_customize->add_control( 'blackcolors_body_fonts', array( 'type' => 'select', 'priority' => 10, 'label' => __('Select your desired font.', 'blackcolors'), 'section' => 'blackcolors_typography', 'choices' => $font_choices ) ); /* Fixed bar background color /*--------------------------------------*/ $wp_customize->add_setting( 'blackcolors_barra_color', array( 'default' => '#2c3e50', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'blackcolors_barra_color', array( 'label' => __('Fixed Bar Background Color', 'blackcolors'), 'section' => 'colors', 'settings' => 'blackcolors_barra_color', ) ) ); /* Text color /*--------------------------------------*/ $wp_customize->add_setting( 'blackcolors_texto_color', array( 'default' => '#ffffff', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'blackcolors_texto_color', array( 'label' => __('Text Color', 'blackcolors'), 'section' => 'colors', 'settings' => 'blackcolors_texto_color', ) ) ); /* Links color /*--------------------------------------*/ $wp_customize->add_setting( 'blackcolors_links_color', array( 'default' => '#e67e22', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'blackcolors_links_color', array( 'label' => __('Links Color', 'blackcolors'), 'section' => 'colors', 'settings' => 'blackcolors_links_color', ) ) ); /* Links color when hover /*--------------------------------------*/ $wp_customize->add_setting( 'blackcolors_links_hover', array( 'default' => '#f1c40f', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'blackcolors_links_hover', array( 'label' => __('Links color when mouse is hover', 'blackcolors'), 'section' => 'colors', 'settings' => 'blackcolors_links_hover', ) ) ); /* Social Links Color /*--------------------------------------*/ $wp_customize->add_setting( 'blackcolors_social_links', array( 'default' => '#f1c40f', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'blackcolors_social_links', array( 'label' => __('Color for the social icons', 'blackcolors'), 'section' => 'colors', 'settings' => 'blackcolors_social_links', ) ) ); /* Galleries background color /*--------------------------------------*/ $wp_customize->add_setting( 'blackcolors_galeria_color', array( 'default' => '#34495e', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'blackcolors_galeria_color', array( 'label' => __('Gallery Background Color', 'blackcolors'), 'section' => 'colors', 'settings' => 'blackcolors_galeria_color', ) ) ); /* Add Section for blackcolors Boxes /*--------------------------------------*/ $wp_customize->add_section( 'blackcolors_boxes', array( 'title' => __( 'Blackcolors Boxes', 'blackcolors' ), 'description' => __( 'Change the url, text and icons of every color box.
For the icons, just go to Fontawesome Icons, select and copy in the respective textbox the name of the icons. For instance, to add the facebook icon, copy "fa-facebook"','blackcolors'), 'priority' => 35, ) ); /* Add color boxes selection /*--------------------------------------*/ $wp_customize->add_setting( 'blackcolors_color_boxes', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'blackcolors_sanitize_checkbox', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'blackcolors_color_boxes', array( 'settings' => 'blackcolors_color_boxes', 'label' => __( 'Show color boxes? ', 'blackcolors' ), 'section' => 'blackcolors_boxes', 'type' => 'checkbox', 'priority' => 1, ) ) ); /* Text and URL for Box 1 /*-------------------------*/ for($i = 1; $i <= 5; $i++){ $wp_customize->add_setting( 'blackcolors_box1_text', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'blackcolors_box1_text', array( 'settings' => 'blackcolors_box1_text', 'label' => __( 'Text on Box 1: ', 'blackcolors' ), 'section' => 'blackcolors_boxes', 'type' => 'text', 'priority' => 1, ) ) ); $wp_customize->add_setting( 'blackcolors_box1_url', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'blackcolors_box1_url', array( 'settings' => 'blackcolors_box1_url', 'label' => __( 'URL on Box 1: ', 'blackcolors' ), 'section' => 'blackcolors_boxes', 'type' => 'text', 'priority' => 2, ) ) ); $wp_customize->add_setting( 'blackcolors_box1_icon', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'blackcolors_box1_icon', array( 'settings' => 'blackcolors_box1_icon', 'label' => __( 'Icon on Box 1: ', 'blackcolors' ), 'section' => 'blackcolors_boxes', 'type' => 'text', 'priority' => 3, ) ) ); } /* Text and URL for Box 2 /*-------------------------*/ $wp_customize->add_setting( 'blackcolors_box2_text', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'blackcolors_box2_text', array( 'settings' => 'blackcolors_box2_text', 'label' => __( 'Text on Box 2: ', 'blackcolors' ), 'section' => 'blackcolors_boxes', 'type' => 'text', 'priority' => 4, ) ) ); $wp_customize->add_setting( 'blackcolors_box2_url', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'blackcolors_box2_url', array( 'settings' => 'blackcolors_box2_url', 'label' => __( 'URL on Box 2: ', 'blackcolors' ), 'section' => 'blackcolors_boxes', 'type' => 'text', 'priority' => 5, ) ) ); $wp_customize->add_setting( 'blackcolors_box2_icon', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'blackcolors_box2_icon', array( 'settings' => 'blackcolors_box2_icon', 'label' => __( 'Icon on Box 2: ', 'blackcolors' ), 'section' => 'blackcolors_boxes', 'type' => 'text', 'priority' => 6, ) ) ); /* Text and URL for Box 3 /*-------------------------*/ $wp_customize->add_setting( 'blackcolors_box3_text', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'blackcolors_box3_text', array( 'settings' => 'blackcolors_box3_text', 'label' => __( 'Text on Box 3: ', 'blackcolors' ), 'section' => 'blackcolors_boxes', 'priority' => 7, 'type' => 'text', ) ) ); $wp_customize->add_setting( 'blackcolors_box3_url', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'blackcolors_box3_url', array( 'settings' => 'blackcolors_box3_url', 'label' => __( 'URL on Box 3: ', 'blackcolors' ), 'section' => 'blackcolors_boxes', 'type' => 'text', 'priority' => 8, ) ) ); $wp_customize->add_setting( 'blackcolors_box3_icon', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'blackcolors_box3_icon', array( 'settings' => 'blackcolors_box3_icon', 'label' => __( 'Icon on Box 3: ', 'blackcolors' ), 'section' => 'blackcolors_boxes', 'type' => 'text', 'priority' => 9, ) ) ); /* Text and URL for Box 4 /*-------------------------*/ $wp_customize->add_setting( 'blackcolors_box4_text', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'blackcolors_box4_text', array( 'settings' => 'blackcolors_box4_text', 'label' => __( 'Text on Box 4: ', 'blackcolors' ), 'section' => 'blackcolors_boxes', 'priority' => 10, 'type' => 'text', ) ) ); $wp_customize->add_setting( 'blackcolors_box4_url', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'blackcolors_box4_url', array( 'settings' => 'blackcolors_box4_url', 'label' => __( 'URL on Box 4: ', 'blackcolors' ), 'section' => 'blackcolors_boxes', 'type' => 'text', 'priority' => 11, ) ) ); $wp_customize->add_setting( 'blackcolors_box4_icon', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'blackcolors_box4_icon', array( 'settings' => 'blackcolors_box4_icon', 'label' => __( 'Icon on Box 4: ', 'blackcolors' ), 'section' => 'blackcolors_boxes', 'type' => 'text', 'priority' => 12, ) ) ); /* Text and URL for Box 5 /*-------------------------*/ $wp_customize->add_setting( 'blackcolors_box5_text', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'blackcolors_box5_text', array( 'settings' => 'blackcolors_box5_text', 'label' => __( 'Text on Box 5: ', 'blackcolors' ), 'section' => 'blackcolors_boxes', 'priority' => 13, 'type' => 'text', ) ) ); $wp_customize->add_setting( 'blackcolors_box5_url', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'blackcolors_box5_url', array( 'settings' => 'blackcolors_box5_url', 'label' => __( 'URL on Box 5: ', 'blackcolors' ), 'section' => 'blackcolors_boxes', 'type' => 'text', 'priority' => 14, ) ) ); $wp_customize->add_setting( 'blackcolors_box5_icon', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'blackcolors_box5_icon', array( 'settings' => 'blackcolors_box5_icon', 'label' => __( 'Icon on Box 5: ', 'blackcolors' ), 'section' => 'blackcolors_boxes', 'type' => 'text', 'priority' => 15, ) ) ); /* Add Section for Social Icons /*--------------------------------------*/ $wp_customize->add_section( 'blackcolors_social_icons', array( 'title' => __( 'Blackcolors Social Icons', 'blackcolors' ), 'description' => __( 'Full in the fields you wish to show with his correspondent url. For instance, for Twitter: https://twitter.com/your_username', 'blackcolors'), 'priority' => 35, ) ); /* Add setting und control for every social icon /*--------------------------------------*/ $blackcolors_social_services = array('fa-twitter' => 'Twitter', 'fa-facebook' => 'Facebook', 'fa-google-plus' => 'Google+', 'fa-behance' => 'Behance', 'fa-codepen' => 'Codepen', 'fa-github' => 'GitHub', 'fa-linkedin' => 'LinkeIn', 'fa-skype' => 'Skype', 'fa-youtube' => 'YouTube', 'fa-slack' => 'Slack', 'fa-tumblr' => 'Tumblr', 'fa-yelp' => 'Yelp', 'fa-instagram' => 'Instagram', 'fa-pinterest' => 'Pinterest', 'fa-flickr' => 'Flickr', 'fa-stack-exchange' => 'Stack Exchange'); $a = 1; foreach($blackcolors_social_services as $id => $valor){ $wp_customize->add_setting( "blackcolors_$id", array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, "blackcolors_$id", array( 'settings' => "blackcolors_$id", 'label' => $valor, // <- Translation function calls must NOT contain PHP variables. Var contains just non-translatable International Brands 'section' => 'blackcolors_social_icons', 'type' => 'text', 'priority' => $a, ) ) ); $a++; } } /* Fonts sanitization /*----------------------------------*/ function blackcolors_sanitize_fonts( $input ) { $valid = array( 'Fira Sans:400,700,400italic,700italic' => 'Fira Sans', 'Merriweather:900,700' => 'Merriweather', 'Source Sans Pro:400,700,400italic,700italic' => 'Source Sans Pro', 'Droid Sans:400,700' => 'Droid Sans', 'Lato:400,700,400italic,700italic' => 'Lato', 'Arvo:400,700,400italic,700italic' => 'Arvo', 'Lora:400,700,400italic,700italic' => 'Lora', 'PT Sans:400,700,400italic,700italic' => 'PT Sans', 'PT+Sans+Narrow:400,700' => 'PT Sans Narrow', 'Arimo:400,700,400italic,700italic' => 'Arimo', 'Ubuntu:400,700,400italic,700italic' => 'Ubuntu', 'Bitter:400,700,400italic' => 'Bitter', 'Droid Serif:400,700,400italic,700italic' => 'Droid Serif', 'Open+Sans:400italic,700italic,400,700' => 'Open Sans', 'Roboto:400,400italic,700,700italic' => 'Roboto', 'Oswald:400,700' => 'Oswald', 'Open Sans Condensed:700,300italic,300' => 'Open Sans Condensed', 'Roboto Condensed:400italic,700italic,400,700' => 'Roboto Condensed', 'Raleway:400,700' => 'Raleway', 'Roboto Slab:400,700' => 'Roboto Slab', 'Yanone Kaffeesatz:400,700' => 'Yanone Kaffeesatz', 'Rokkitt:400' => 'Rokkitt', ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } /* Checkbox Sanitization /*----------------------------------*/ function blackcolors_sanitize_checkbox( $input ) { if ( $input == 1 ) { return 1; } else { return ''; } } ?>