' . esc_attr($important_link['text']) . '

'; } } } /** * This setting has the dummy Sanitizaition function as it contains no value to be sanitized */ $wp_customize->add_setting('bistic_important_links', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_links_sanitize' )); $wp_customize->add_control(new bistic_Important_Links($wp_customize, 'important_links', array( 'label' => __('Important Links', 'bistic'), 'section' => 'bistic_important_links', 'settings' => 'bistic_important_links' ))); // Theme Important Links Ended // Start of the Header Options $wp_customize->add_panel('bistic_header_options', array( 'capabitity' => 'edit_theme_options', 'description' => __('Change the Header Settings from here as you want', 'bistic'), 'priority' => 500, 'title' => __('Header Options', 'bistic') )); // breaking news enable/disable $wp_customize->add_section('bistic_breaking_news_section', array( 'title' => __('Breaking News', 'bistic'), 'panel' => 'bistic_header_options' )); $wp_customize->add_setting('bistic_breaking_news', array( 'priority' => 1, 'default' => 1, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_checkbox_sanitize' )); $wp_customize->add_control('bistic_breaking_news', array( 'type' => 'checkbox', 'label' => __('Check to enable the breaking news section', 'bistic'), 'section' => 'bistic_breaking_news_section', 'settings' => 'bistic_breaking_news' )); // date display enable/disable $wp_customize->add_section('bistic_date_display_section', array( 'title' => __('Show Date', 'bistic'), 'panel' => 'bistic_header_options' )); $wp_customize->add_setting('bistic_date_display', array( 'priority' => 2, 'default' => 1, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_checkbox_sanitize' )); $wp_customize->add_control('bistic_date_display', array( 'type' => 'checkbox', 'label' => __('Check to show the date in header', 'bistic'), 'section' => 'bistic_date_display_section', 'settings' => 'bistic_date_display' )); // home icon enable/disable in primary menu $wp_customize->add_section('bistic_home_icon_display_section', array( 'title' => __('Show Home Icon', 'bistic'), 'panel' => 'bistic_header_options' )); $wp_customize->add_setting('bistic_home_icon_display', array( 'priority' => 3, 'default' => 1, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_checkbox_sanitize' )); $wp_customize->add_control('bistic_home_icon_display', array( 'type' => 'checkbox', 'label' => __('Check to show the home icon in the primary menu', 'bistic'), 'section' => 'bistic_home_icon_display_section', 'settings' => 'bistic_home_icon_display' )); // primary sticky menu enable/disable $wp_customize->add_section('bistic_primary_sticky_menu_section', array( 'title' => __('Sticky Menu', 'bistic'), 'panel' => 'bistic_header_options' )); $wp_customize->add_setting('bistic_primary_sticky_menu', array( 'priority' => 4, 'default' => 1, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_checkbox_sanitize' )); $wp_customize->add_control('bistic_primary_sticky_menu', array( 'type' => 'checkbox', 'label' => __('Check to enable the sticky behavior of the primary menu', 'bistic'), 'section' => 'bistic_primary_sticky_menu_section', 'settings' => 'bistic_primary_sticky_menu' )); // search icon in menu enable/disable $wp_customize->add_section('bistic_search_icon_in_menu_section', array( 'title' => __('Search Icon', 'bistic'), 'panel' => 'bistic_header_options' )); $wp_customize->add_setting('bistic_search_icon_in_menu', array( 'priority' => 5, 'default' => 1, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_checkbox_sanitize' )); $wp_customize->add_control('bistic_search_icon_in_menu', array( 'type' => 'checkbox', 'label' => __('Check to display the Search Icon in the primary menu', 'bistic'), 'section' => 'bistic_search_icon_in_menu_section', 'settings' => 'bistic_search_icon_in_menu' )); // random posts in menu enable/disable $wp_customize->add_section('bistic_random_post_in_menu_section', array( 'title' => __('Random Post', 'bistic'), 'panel' => 'bistic_header_options' )); $wp_customize->add_setting('bistic_random_post_in_menu', array( 'priority' => 6, 'default' => 1, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_checkbox_sanitize' )); $wp_customize->add_control('bistic_random_post_in_menu', array( 'type' => 'checkbox', 'label' => __('Check to display the Random Post Icon in the primary menu', 'bistic'), 'section' => 'bistic_random_post_in_menu_section', 'settings' => 'bistic_random_post_in_menu' )); // logo upload options $wp_customize->add_section('bistic_header_logo', array( 'priority' => 1, 'title' => __('Header Logo', 'bistic'), 'panel' => 'bistic_header_options' )); $wp_customize->add_setting('bistic_logo', array( 'default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'bistic_logo', array( 'label' => __('Upload logo for your header', 'bistic'), 'section' => 'bistic_header_logo', 'setting' => 'bistic_logo' ))); $wp_customize->add_setting('bistic_header_logo_placement', array( 'default' => 'header_text_only', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_show_radio_saniztize' )); $wp_customize->add_control('bistic_header_logo_placement', array( 'type' => 'radio', 'label' => __('Choose the option that you want', 'bistic'), 'section' => 'bistic_header_logo', 'choices' => array( 'header_logo_only' => __('Header Logo Only', 'bistic'), 'header_text_only' => __('Header Text Only', 'bistic'), 'show_both' => __('Show Both', 'bistic'), 'disable' => __('Disable', 'bistic') ) )); // header image position setting $wp_customize->add_section('bistic_header_image_position_setting', array( 'priority' => 6, 'title' => __('Header Image Position', 'bistic'), 'panel' => 'bistic_header_options' )); $wp_customize->add_setting('bistic_header_image_position', array( 'default' => 'position_two', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_header_image_position_sanitize' )); $wp_customize->add_control('bistic_header_image_position', array( 'type' => 'radio', 'label' => __('Header image display position', 'bistic'), 'section' => 'bistic_header_image_position_setting', 'choices' => array( 'position_one' => __('Display the Header image just above the site title/text.', 'bistic'), 'position_two' => __('Default: Display the Header image between site title/text and the main/primary menu.', 'bistic'), 'position_three' => __('Display the Header image below main/primary menu.', 'bistic') ) )); $wp_customize->add_setting('bistic_header_image_link', array( 'default' => 0, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_checkbox_sanitize' )); $wp_customize->add_control('bistic_header_image_link', array( 'type' => 'checkbox', 'label' => __('Check to make header image link back to home page', 'bistic'), 'section' => 'bistic_header_image_position_setting' )); // Start of the Design Options $wp_customize->add_panel('bistic_design_options', array( 'capabitity' => 'edit_theme_options', 'description' => __('Change the Design Settings from here as you want', 'bistic'), 'priority' => 505, 'title' => __('Design Options', 'bistic') )); // FrontPage setting $wp_customize->add_section('bistic_front_page_setting', array( 'priority' => 1, 'title' => __('Front Page Settings', 'bistic'), 'panel' => 'bistic_design_options' )); $wp_customize->add_setting('bistic_hide_blog_front', array( 'default' => 0, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_checkbox_sanitize' )); $wp_customize->add_control('bistic_hide_blog_front', array( 'type' => 'checkbox', 'label' => __('Check to hide blog posts/static page on front page', 'bistic'), 'section' => 'bistic_front_page_setting' )); // site layout setting $wp_customize->add_section('bistic_site_layout_setting', array( 'priority' => 2, 'title' => __('Site Layout', 'bistic'), 'panel' => 'bistic_design_options' )); $wp_customize->add_setting('bistic_site_layout', array( 'default' => 'wide_layout', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_site_layout_sanitize' )); $wp_customize->add_control('bistic_site_layout', array( 'type' => 'radio', 'label' => __('Choose your site layout. The change is reflected in whole site', 'bistic'), 'choices' => array( 'boxed_layout' => __('Boxed Layout', 'bistic'), 'wide_layout' => __('Wide Layout', 'bistic') ), 'section' => 'bistic_site_layout_setting' )); class bistic_Image_Radio_Control extends WP_Customize_Control { public function render_content() { if ( empty( $this->choices ) ) return; $name = '_customize-radio-' . $this->id; ?> label ); ?> add_section('bistic_default_layout_setting', array( 'priority' => 3, 'title' => __('Default layout', 'bistic'), 'panel'=> 'bistic_design_options' )); $wp_customize->add_setting('bistic_default_layout', array( 'default' => 'no_sidebar_full_width', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_layout_sanitize' )); $wp_customize->add_control(new bistic_Image_Radio_Control($wp_customize, 'bistic_default_layout', array( 'type' => 'radio', 'label' => __('Select default layout. This layout will be reflected in whole site archives, categories, search page etc. The layout for a single post and page can be controlled from below options', 'bistic'), 'section' => 'bistic_default_layout_setting', 'settings' => 'bistic_default_layout', 'choices' => array( 'right_sidebar' => get_template_directory_uri() . '/inc/admin/images/right-sidebar.png', 'left_sidebar' => get_template_directory_uri() . '/inc/admin/images/left-sidebar.png', 'no_sidebar_full_width' => get_template_directory_uri() . '/inc/admin/images/no-sidebar-full-width-layout.png', 'no_sidebar_content_centered' => get_template_directory_uri() . '/inc/admin/images/no-sidebar-content-centered-layout.png' ) ))); // default layout for pages $wp_customize->add_section('bistic_default_page_layout_setting', array( 'priority' => 4, 'title' => __('Default layout for pages only', 'bistic'), 'panel'=> 'bistic_design_options' )); $wp_customize->add_setting('bistic_default_page_layout', array( 'default' => 'right_sidebar', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_layout_sanitize' )); $wp_customize->add_control(new bistic_Image_Radio_Control($wp_customize, 'bistic_default_page_layout', array( 'type' => 'radio', 'label' => __('Select default layout for pages. This layout will be reflected in all pages unless unique layout is set for specific page', 'bistic'), 'section' => 'bistic_default_page_layout_setting', 'settings' => 'bistic_default_page_layout', 'choices' => array( 'right_sidebar' => get_template_directory_uri() . '/inc/admin/images/right-sidebar.png', 'left_sidebar' => get_template_directory_uri() . '/inc/admin/images/left-sidebar.png', 'no_sidebar_full_width' => get_template_directory_uri() . '/inc/admin/images/no-sidebar-full-width-layout.png', 'no_sidebar_content_centered' => get_template_directory_uri() . '/inc/admin/images/no-sidebar-content-centered-layout.png' ) ))); // default layout for single posts $wp_customize->add_section('bistic_default_single_posts_layout_setting', array( 'priority' => 5, 'title' => __('Default layout for single posts only', 'bistic'), 'panel'=> 'bistic_design_options' )); $wp_customize->add_setting('bistic_default_single_posts_layout', array( 'default' => 'right_sidebar', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_layout_sanitize' )); $wp_customize->add_control(new bistic_Image_Radio_Control($wp_customize, 'bistic_default_single_posts_layout', array( 'type' => 'radio', 'label' => __('Select default layout for single posts. This layout will be reflected in all single posts unless unique layout is set for specific post', 'bistic'), 'section' => 'bistic_default_single_posts_layout_setting', 'settings' => 'bistic_default_single_posts_layout', 'choices' => array( 'right_sidebar' => get_template_directory_uri() . '/inc/admin/images/right-sidebar.png', 'left_sidebar' => get_template_directory_uri() . '/inc/admin/images/left-sidebar.png', 'no_sidebar_full_width' => get_template_directory_uri() . '/inc/admin/images/no-sidebar-full-width-layout.png', 'no_sidebar_content_centered' => get_template_directory_uri() . '/inc/admin/images/no-sidebar-content-centered-layout.png' ) ))); // primary color options $wp_customize->add_section('bistic_primary_color_setting', array( 'panel' => 'bistic_design_options', 'priority' => 7, 'title' => __('Primary color option', 'bistic') )); $wp_customize->add_setting('bistic_primary_color', array( 'default' => '#25ba2a', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_color_option_hex_sanitize', 'sanitize_js_callback' => 'bistic_color_escaping_option_sanitize' )); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'bistic_primary_color', array( 'label' => __('This will reflect in links, buttons and many others. Choose a color to match your site', 'bistic'), 'section' => 'bistic_primary_color_setting', 'settings' => 'bistic_primary_color' ))); // End of the Design Options // Start of the Social Link Options $wp_customize->add_panel('bistic_social_links_options', array( 'priority' => 510, 'title' => __('Social Options', 'bistic'), 'description'=> __('Change the Social Links Settings from here as you want', 'bistic'), 'capability' => 'edit_theme_options', )); $wp_customize->add_section('bistic_social_link_activate_settings', array( 'priority' => 1, 'title' => __('Activate social links area', 'bistic'), 'panel' => 'bistic_social_links_options' )); $wp_customize->add_setting('bistic_social_link_activate', array( 'default' => 1, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_checkbox_sanitize' )); $wp_customize->add_control('bistic_social_link_activate', array( 'type' => 'checkbox', 'label' => __('Check to activate social links area', 'bistic'), 'section' => 'bistic_social_link_activate_settings', 'settings' => 'bistic_social_link_activate' )); $bistic_social_links = array( 'bistic_social_facebook' => array( 'id' => 'bistic_social_facebook', 'title' => __('Facebook', 'bistic'), 'default' => 'https://www.facebook.com/' ), 'bistic_social_twitter' => array( 'id' => 'bistic_social_twitter', 'title' => __('Twitter', 'bistic'), 'default' => 'https://www.twitter.com/' ), 'bistic_social_googleplus' => array( 'id' => 'bistic_social_googleplus', 'title' => __('Google-Plus', 'bistic'), 'default' => 'https://www.google.com/' ), 'bistic_social_instagram' => array( 'id' => 'bistic_social_instagram', 'title' => __('Instagram', 'bistic'), 'default' => 'https://www.instagram.com/' ), 'bistic_social_pinterest' => array( 'id' => 'bistic_social_pinterest', 'title' => __('Pinterest', 'bistic'), 'default' => 'https://www.pinterest.com/' ), 'bistic_social_youtube' => array( 'id' => 'bistic_social_youtube', 'title' => __('YouTube', 'bistic'), 'default' => 'https://www.youtube.com/' ), ); $i = 20; foreach($bistic_social_links as $bistic_social_link) { $wp_customize->add_setting($bistic_social_link['id'], array( 'default' => $bistic_social_link['default'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control($bistic_social_link['id'], array( 'label' => $bistic_social_link['title'], 'section'=> 'bistic_social_link_activate_settings', 'settings'=> $bistic_social_link['id'], 'priority' => $i )); $wp_customize->add_setting($bistic_social_link['id'].'_checkbox', array( 'default' => 1, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_checkbox_sanitize' )); $wp_customize->add_control($bistic_social_link['id'].'_checkbox', array( 'type' => 'checkbox', 'label' => __('Check to show in new tab', 'bistic'), 'section'=> 'bistic_social_link_activate_settings', 'settings'=> $bistic_social_link['id'].'_checkbox', 'priority' => $i )); $i++; } // End of the Social Link Options // Start of the Additional Options $wp_customize->add_panel('bistic_additional_options', array( 'capability' => 'edit_theme_options', 'description'=> __('Change the Additional Settings from here as you want', 'bistic'), 'priority' => 515, 'title' => __('Additional Options', 'bistic') )); // favicon options $wp_customize->add_section('bistic_favicon_show_setting', array( 'priority' => 1, 'title' => __('Activate favicon', 'bistic'), 'panel' => 'bistic_additional_options' )); $wp_customize->add_setting('bistic_favicon_show', array( 'default' => 0, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_checkbox_sanitize' )); $wp_customize->add_control('bistic_favicon_show', array( 'type' => 'checkbox', 'label' => __('Check to activate favicon. Upload favicon from below option', 'bistic'), 'section' => 'bistic_favicon_show_setting', 'settings' => 'bistic_favicon_show' )); $wp_customize->add_setting('bistic_favicon_upload', array( 'default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'bistic_favicon_upload', array( 'label' => __('Upload favicon for your site', 'bistic'), 'section' => 'bistic_favicon_show_setting', 'settings' => 'bistic_favicon_upload' ))); // related posts $wp_customize->add_section('bistic_related_posts_section', array( 'priority' => 4, 'title' => __('Related Posts', 'bistic'), 'panel' => 'bistic_additional_options' )); $wp_customize->add_setting('bistic_related_posts_activate', array( 'default' => 1, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_checkbox_sanitize' )); $wp_customize->add_control('bistic_related_posts_activate', array( 'type' => 'checkbox', 'label' => __('Check to activate the related posts', 'bistic'), 'section' => 'bistic_related_posts_section', 'settings' => 'bistic_related_posts_activate' )); $wp_customize->add_setting('bistic_related_posts', array( 'default' => 'categories', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_related_posts_sanitize' )); $wp_customize->add_control('bistic_related_posts', array( 'type' => 'radio', 'label' => __('Related Posts Must Be Shown As:', 'bistic'), 'section' => 'bistic_related_posts_section', 'settings' => 'bistic_related_posts', 'choices' => array( 'categories' => __('Related Posts By Categories', 'bistic'), 'tags' => __('Related Posts By Tags', 'bistic') ) )); // featured image popup check $wp_customize->add_section('bistic_featured_image_popup_setting', array( 'priority' => 6, 'title' => __('Image Lightbox', 'bistic'), 'panel' => 'bistic_additional_options' )); $wp_customize->add_setting('bistic_featured_image_popup', array( 'default' => 1, 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_checkbox_sanitize' )); $wp_customize->add_control('bistic_featured_image_popup', array( 'type' => 'checkbox', 'label' => __('Check to enable the lightbox for the featured images in single post', 'bistic'), 'section' => 'bistic_featured_image_popup_setting', 'settings' => 'bistic_featured_image_popup' )); // End of the Additional Options // Category Color Options $wp_customize->add_panel('bistic_category_color_panel', array( 'priority' => 535, 'title' => __('Category Color Options', 'bistic'), 'capability' => 'edit_theme_options', 'description' => __('Change the color of each category items as you want.', 'bistic') )); $wp_customize->add_section('bistic_category_color_setting', array( 'priority' => 1, 'title' => __('Category Color Settings', 'bistic'), 'panel' => 'bistic_category_color_panel' )); $i = 1; $args = array( 'orderby' => 'id', 'hide_empty' => 0 ); $categories = get_categories( $args ); $wp_category_list = array(); foreach ($categories as $category_list ) { $wp_category_list[$category_list->cat_ID] = $category_list->cat_name; $wp_customize->add_setting('bistic_category_color_'.get_cat_id($wp_category_list[$category_list->cat_ID]), array( 'default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bistic_color_option_hex_sanitize', 'sanitize_js_callback' => 'bistic_color_escaping_option_sanitize' )); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'bistic_category_color_'.get_cat_id($wp_category_list[$category_list->cat_ID]), array( 'label' => sprintf(__('%s', 'bistic'), $wp_category_list[$category_list->cat_ID] ), 'section' => 'bistic_category_color_setting', 'settings' => 'bistic_category_color_'.get_cat_id($wp_category_list[$category_list->cat_ID]), 'priority' => $i ))); $i++; } // sanitization works // radio button sanitization function bistic_related_posts_sanitize($input) { $valid_keys = array( 'categories' => __('Related Posts By Categories', 'bistic'), 'tags' => __('Related Posts By Tags', 'bistic') ); if ( array_key_exists( $input, $valid_keys ) ) { return $input; } else { return ''; } } function bistic_show_radio_saniztize($input) { $valid_keys = array( 'header_logo_only' => __('Header Logo Only', 'bistic'), 'header_text_only' => __('Header Text Only', 'bistic'), 'show_both' => __('Show Both', 'bistic'), 'disable' => __('Disable', 'bistic') ); if ( array_key_exists( $input, $valid_keys ) ) { return $input; } else { return ''; } } function bistic_header_image_position_sanitize($input) { $valid_keys = array( 'position_one' => __('Display the Header image just above the site title/text.', 'bistic'), 'position_two' => __('Default: Display the Header image between site title/text and the main/primary menu.', 'bistic'), 'position_three' => __('Display the Header image below main/primary menu.', 'bistic') ); if ( array_key_exists( $input, $valid_keys ) ) { return $input; } else { return ''; } } function bistic_site_layout_sanitize($input) { $valid_keys = array( 'boxed_layout' => __('Boxed Layout', 'bistic'), 'wide_layout' => __('Wide Layout', 'bistic') ); if ( array_key_exists( $input, $valid_keys ) ) { return $input; } else { return ''; } } function bistic_layout_sanitize($input) { $valid_keys = array( 'right_sidebar' => get_template_directory_uri() . '/inc/admin/images/right-sidebar.png', 'left_sidebar' => get_template_directory_uri() . '/inc/admin/images/left-sidebar.png', 'no_sidebar_full_width' => get_template_directory_uri() . '/inc/admin/images/no-sidebar-full-width-layout.png', 'no_sidebar_content_centered' => get_template_directory_uri() . '/inc/admin/images/no-sidebar-content-centered-layout.png' ); if ( array_key_exists( $input, $valid_keys ) ) { return $input; } else { return ''; } } // color sanitization function bistic_color_option_hex_sanitize($color) { if ($unhashed = sanitize_hex_color_no_hash($color)) return '#' . $unhashed; return $color; } function bistic_color_escaping_option_sanitize($input) { $input = esc_attr($input); return $input; } // checkbox sanitization function bistic_checkbox_sanitize($input) { if ( $input == 1 ) { return 1; } else { return ''; } } // sanitization of links function bistic_links_sanitize() { return false; } } add_action('customize_register', 'bistic_customize_register');