array( 'link' => esc_url('http://www.dhakabikeshow.com/blankcheers/'), 'text' => __('Theme Info', 'blankcheers'), ), 'support' => array( 'link' => esc_url('http://www.dhakabikeshow.com/blankcheers/'), 'text' => __('Support Forum', 'blankcheers'), ), 'demo' => array( 'link' => esc_url('http://www.dhakabikeshow.com/blankcheers/'), 'text' => __('View Demo', 'blankcheers'), ), 'rating' => array( 'link' => esc_url('http://wordpress.org/support/view/theme-reviews/blankcheers?filter=5'), 'text' => __('Rate this theme', 'blankcheers'), ), ); foreach ($important_links as $important_link) { echo '
'; } } } $wp_customize->add_section('blankcheers_important_links', array( 'priority' => 1, 'title' => __('blankcheers Important Links', 'blankcheers'), )); /** * This setting has the dummy Sanitization function as it contains no value to be sanitized */ $wp_customize->add_setting('blankcheers_important_links', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'blankcheers_links_sanitize' )); $wp_customize->add_control(new blankcheers_Important_Links($wp_customize, 'important_links', array( 'section' => 'blankcheers_important_links', 'settings' => 'blankcheers_important_links' ))); // Theme Important Links Ended /* * Assigning the theme name */ $blankcheers_themename = get_option( 'stylesheet' ); $blankcheers_themename = preg_replace("/\W/", "_", strtolower( $blankcheers_themename ) ); // Start of the Header Options // Header Options Area $wp_customize->add_panel('blankcheers_header_options', array( 'capabitity' => 'edit_theme_options', 'priority' => 500, 'title' => __('Header', 'blankcheers') )); // Header Logo upload option $wp_customize->add_section('blankcheers_header_logo', array( 'priority' => 1, 'title' => __('Header Logo', 'blankcheers'), 'panel' => 'blankcheers_header_options' )); if ( ! function_exists('the_custom_logo') ) { $wp_customize->add_setting($blankcheers_themename.'[blankcheers_header_logo_image]', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, $blankcheers_themename.'[blankcheers_header_logo_image]', array( 'label' => __('Upload logo for your header. Recommended size is 100 X 100 pixels but you can add any size you like.', 'blankcheers'), 'section' => 'blankcheers_header_logo', 'setting' => $blankcheers_themename.'[blankcheers_header_logo_image]' ))); } // Header logo and text display type option $wp_customize->add_section('blankcheers_show_option', array( 'priority' => 2, 'title' => __('Show', 'blankcheers'), 'panel' => 'blankcheers_header_options' )); $wp_customize->add_setting($blankcheers_themename.'[blankcheers_show_header_logo_text]', array( 'default' => 'text_only', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'blankcheers_radio_select_sanitize' )); $wp_customize->add_control($blankcheers_themename.'[blankcheers_show_header_logo_text]', array( 'type' => 'radio', 'label' => __('Choose the option that you want.', 'blankcheers'), 'section' => 'blankcheers_show_option', 'choices' => array( 'logo_only' => __('Header Logo Only', 'blankcheers'), 'text_only' => __('Header Text Only', 'blankcheers'), 'both' => __('Show Both', 'blankcheers'), 'none' => __('Disable', 'blankcheers') ) )); // Header image position option $wp_customize->add_section('blankcheers_header_image_position_section', array( 'priority' => 3, 'title' => __('Header Image Position', 'blankcheers'), 'panel' => 'blankcheers_header_options' )); $wp_customize->add_setting($blankcheers_themename.'[blankcheers_header_image_position]', array( 'default' => 'position_two', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'blankcheers_radio_select_sanitize' )); $wp_customize->add_control($blankcheers_themename.'[blankcheers_header_image_position]', array( 'type' => 'radio', 'label' => __('Choose top header image display position.','blankcheers'), 'section' => 'blankcheers_header_image_position_section', 'choices' => array( 'position_one' => __( 'Position One: Display the Header image just above the site title/text.', 'blankcheers' ), 'position_two' => __( 'Position Two (Default): Display the Header image between site title/text and the main/primary menu.', 'blankcheers' ), 'position_three' => __( 'Position Three: Display the Header image below main/primary menu.', 'blankcheers' ) ) )); // New Responsive Menu $wp_customize->add_section('blankcheers_new_menu', array( 'priority' => 4, 'title' => __('Responsive Menu Style', 'blankcheers'), 'panel' => 'blankcheers_header_options' )); $wp_customize->add_setting($blankcheers_themename.'[blankcheers_new_menu]', array( 'default' => '1', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'blankcheers_checkbox_sanitize' )); $wp_customize->add_control($blankcheers_themename.'[blankcheers_new_menu]', array( 'type' => 'checkbox', 'label' => __('Switch to new responsive menu.', 'blankcheers'), 'section' => 'blankcheers_new_menu' )); // End of Header Options if ( ! function_exists( 'has_site_icon' ) ) { // Start of the Additional Options $wp_customize->add_panel('blankcheers_additional_options', array( 'capabitity' => 'edit_theme_options', 'priority' => 510, 'title' => __('Additional', 'blankcheers') )); // favicon activate option $wp_customize->add_section('blankcheers_additional_activate_section', array( 'priority' => 1, 'title' => __('Activate favicon', 'blankcheers'), 'panel' => 'blankcheers_additional_options' )); $wp_customize->add_setting($blankcheers_themename.'[blankcheers_activate_favicon]', array( 'default' => 0, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'blankcheers_checkbox_sanitize' )); $wp_customize->add_control($blankcheers_themename.'[blankcheers_activate_favicon]', array( 'type' => 'checkbox', 'label' => __('Check to activate favicon. Upload fav icon from below option', 'blankcheers'), 'section' => 'blankcheers_additional_activate_section', 'settings' => $blankcheers_themename.'[blankcheers_activate_favicon]' )); // favicon upload option $wp_customize->add_section('blankcheers_favicon_upload_section',array( 'priority' => 2, 'title' => __('Upload favicon', 'blankcheers'), 'panel' => 'blankcheers_additional_options' )); $wp_customize->add_setting($blankcheers_themename.'[blankcheers_favicon]', array( 'default' => 0, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, $blankcheers_themename.'[blankcheers_favicon]', array( 'label' => __('Upload favicon for your site.', 'blankcheers'), 'section' => 'blankcheers_favicon_upload_section', 'settings' => $blankcheers_themename.'[blankcheers_favicon]' ))); // End of Additional Options } // Adding Text Area Control For Use In Customizer class blankcheers_Text_Area_Control extends WP_Customize_Control { public $type = 'text_area'; public function render_content() { ?> add_panel('blankcheers_slider_options', array( 'capabitity' => 'edit_theme_options', 'priority' => 515, 'title' => __('Slider', 'blankcheers') )); // Slider activate option $wp_customize->add_section('blankcheers_slider_activate_section', array( 'priority' => 1, 'title' => __('Activate slider', 'blankcheers'), 'panel' => 'blankcheers_slider_options' )); $wp_customize->add_setting($blankcheers_themename.'[blankcheers_activate_slider]', array( 'default' => 0, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'blankcheers_checkbox_sanitize' )); $wp_customize->add_control($blankcheers_themename.'[blankcheers_activate_slider]', array( 'type' => 'checkbox', 'label' => __('Check to activate slider.', 'blankcheers'), 'section' => 'blankcheers_slider_activate_section', 'settings' => $blankcheers_themename.'[blankcheers_activate_slider]' )); for ( $i = 1; $i <= 4; $i++ ) { // adding slider section $wp_customize->add_section('blankcheers_slider_number_section'.$i, array( 'priority' => 10, 'title' => sprintf( __( 'Slider #%1$s', 'blankcheers' ), $i ), 'panel' => 'blankcheers_slider_options' )); // adding slider image url $wp_customize->add_setting($blankcheers_themename.'[blankcheers_slider_image'.$i.']', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, $blankcheers_themename.'[blankcheers_slider_image'.$i.']', array( 'label' => __('Upload image', 'blankcheers'), 'section' => 'blankcheers_slider_number_section'.$i, 'setting' => $blankcheers_themename.'[blankcheers_slider_image'.$i.']' ))); // adding slider title $wp_customize->add_setting($blankcheers_themename.'[blankcheers_slider_title'.$i.']', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_filter_nohtml_kses' )); $wp_customize->add_control($blankcheers_themename.'[blankcheers_slider_title'.$i.']', array( 'label' => __('Enter title for this slide','blankcheers'), 'section' => 'blankcheers_slider_number_section'.$i, 'setting' => $blankcheers_themename.'[blankcheers_slider_title'.$i.']' )); // adding button url $wp_customize->add_setting($blankcheers_themename.'[blankcheers_slider_link'.$i.']', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control($blankcheers_themename.'[blankcheers_slider_link'.$i.']', array( 'label' => __('Enter link to redirect for the slide title','blankcheers'), 'section' => 'blankcheers_slider_number_section'.$i, 'setting' => $blankcheers_themename.'[blankcheers_slider_link'.$i.']' )); } // End of Slider Options // Start of data sanitization function blankcheers_radio_select_sanitize( $input, $setting ) { // Ensuring that the input is a slug. $input = sanitize_key( $input ); // Get the 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, else, return the default. return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } // color sanitization function blankcheers_color_option_hex_sanitize($color) { if ($unhashed = sanitize_hex_color_no_hash($color)) return '#' . $unhashed; return $color; } function blankcheers_color_escaping_option_sanitize($input) { $input = esc_attr($input); return $input; } // text-area sanitize function blankcheers_text_sanitize($input) { return wp_kses_post( force_balance_tags( $input ) ); } // checkbox sanitize function blankcheers_checkbox_sanitize($input) { if ( $input == 1 ) { return 1; } else { return ''; } } // sanitization of links function blankcheers_links_sanitize() { return false; } } add_action('customize_register', 'blankcheers_customize_register'); /*****************************************************************************************/ /* * Custom Scripts */ add_action( 'customize_controls_print_footer_scripts', 'blankcheers_customizer_custom_scripts' ); function blankcheers_customizer_custom_scripts() { ?>