=') ) { $wp_customize->get_section( 'static_front_page' )->title = __( 'Static Front Page', 'beautystore' ); } $beautystore_options_posts = array(); $beautystore_options_posts_obj = get_posts('posts_per_page=-1'); $beautystore_options_posts[''] = __( 'Choose Post', 'beautystore' ); foreach ( $beautystore_options_posts_obj as $beautystore_posts ) { $beautystore_options_posts[$beautystore_posts->ID] = $beautystore_posts->post_title; } $beautystore_options_pages = array(); $beautystore_options_pages_obj = get_pages('posts_per_page=-1'); $beautystore_options_pages[''] = __( 'Choose Page', 'beautystore' ); foreach ( $beautystore_options_pages_obj as $beautystore_pages ) { $beautystore_options_pages[$beautystore_pages->ID] = $beautystore_pages->post_title; } $beautystore_args = array( 'type' => 'post', 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 1, 'hierarchical' => 1, 'taxonomy' => 'category' ); $beautystore_option_categories = array(); $beautystore_category_lists = get_categories( $beautystore_args ); $beautystore_option_categories[''] = __( 'Choose Category', 'beautystore' ); foreach( $beautystore_category_lists as $beautystore_category ){ $beautystore_option_categories[$beautystore_category->term_id] = $beautystore_category->name; } $wp_customize->add_panel( 'wp_default_panel', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( 'Default Settings', 'beautystore' ), 'description' => __( 'Default section provided by wordpress customizer.', 'beautystore' ), ) ); $wp_customize->get_section( 'title_tagline' )->panel = 'wp_default_panel'; $wp_customize->get_section( 'colors' )->panel = 'wp_default_panel'; $wp_customize->get_section( 'header_image' )->panel = 'wp_default_panel'; $wp_customize->get_section( 'background_image' )->panel = 'wp_default_panel'; $wp_customize->get_section( 'static_front_page' )->panel = 'wp_default_panel'; $wp_customize->get_setting( 'blogname' )->transport = 'refresh'; $wp_customize->get_setting( 'blogdescription' )->transport = 'refresh'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'refresh'; /** Front Page Settings */ $wp_customize->add_panel( 'beautystore_home_page_settings', array( 'priority' => 30, 'capability' => 'edit_theme_options', 'title' => __( 'Home Page Settings', 'beautystore' ), 'description' => __( 'Customize Home Page Settings', 'beautystore' ), ) ); /** Front Page Banner */ $wp_customize->add_section( 'beautystore_banner_settings', array( 'title' => __( 'Banner Section', 'beautystore' ), 'priority' => 10, 'panel' => 'beautystore_home_page_settings', ) ); $wp_customize->add_setting( 'beautystore_ed_banner_section', array( 'default' => '', 'sanitize_callback' => 'beautystore_sanitize_checkbox', ) ); $wp_customize->add_control( 'beautystore_ed_banner_section', array( 'label' => __( 'Enable Banner Section', 'beautystore' ), 'section' => 'beautystore_banner_settings', 'type' => 'checkbox', ) ); $wp_customize->add_setting( 'beautystore_banner_post', array( 'default' => '', 'sanitize_callback' => 'beautystore_sanitize_select', ) ); $wp_customize->add_control( 'beautystore_banner_post', array( 'label' => __( 'Select Banner Section Page', 'beautystore' ), 'section' => 'beautystore_banner_settings', 'type' => 'select', 'choices' => $beautystore_options_pages, ) ); /** Front Page Service Settings */ $wp_customize->add_section( 'beautystore_featured_settings', array( 'title' => __( 'Feature Section', 'beautystore' ), 'priority' => 30, 'description' => __('Use featured Image To Display Font icon or Image ','beautystore'), 'panel' => 'beautystore_home_page_settings', ) ); $wp_customize->add_setting( 'beautystore_ed_featured_section', array( 'default' => '', 'sanitize_callback' => 'beautystore_sanitize_checkbox', ) ); $wp_customize->add_control( 'beautystore_ed_featured_section', array( 'label' => __( 'Enable Service Pages Section', 'beautystore' ), 'section' => 'beautystore_featured_settings', 'type' => 'checkbox', ) ); $wp_customize->add_setting( 'beautystore_featured_post_one', array( 'default' => '', 'sanitize_callback' => 'beautystore_sanitize_select', ) ); $wp_customize->add_control( 'beautystore_featured_post_one', array( 'label' => __( 'Select Service Page One', 'beautystore' ), 'section' => 'beautystore_featured_settings', 'type' => 'select', 'choices' => $beautystore_options_pages, ) ); $wp_customize->add_setting( 'beautystore_featured_post_two', array( 'default' => '', 'sanitize_callback' => 'beautystore_sanitize_select', ) ); $wp_customize->add_control( 'beautystore_featured_post_two', array( 'label' => __( 'Select Service Page Two', 'beautystore' ), 'section' => 'beautystore_featured_settings', 'type' => 'select', 'choices' => $beautystore_options_pages, ) ); $wp_customize->add_setting( 'beautystore_featured_post_three', array( 'default' => '', 'sanitize_callback' => 'beautystore_sanitize_select', ) ); $wp_customize->add_control( 'beautystore_featured_post_three', array( 'label' => __( 'Select Service Page Three', 'beautystore' ), 'section' => 'beautystore_featured_settings', 'type' => 'select', 'choices' => $beautystore_options_pages, ) ); $wp_customize->add_setting( 'beautystore_featured_post_four', array( 'default' => '', 'sanitize_callback' => 'beautystore_sanitize_select', ) ); $wp_customize->add_control( 'beautystore_featured_post_four', array( 'label' => __( 'Select Service Page Four', 'beautystore' ), 'section' => 'beautystore_featured_settings', 'type' => 'select', 'choices' => $beautystore_options_pages, ) ); $wp_customize->add_setting( 'beautystore_featured_post_five', array( 'default' => '', 'sanitize_callback' => 'beautystore_sanitize_select', ) ); $wp_customize->add_control( 'beautystore_featured_post_five', array( 'label' => __( 'Select Service Page Five', 'beautystore' ), 'section' => 'beautystore_featured_settings', 'type' => 'select', 'choices' => $beautystore_options_pages, ) ); $wp_customize->add_setting( 'beautystore_featured_post_six', array( 'default' => '', 'sanitize_callback' => 'beautystore_sanitize_select', ) ); $wp_customize->add_control( 'beautystore_featured_post_six', array( 'label' => __( 'Select Service Page Six', 'beautystore' ), 'section' => 'beautystore_featured_settings', 'type' => 'select', 'choices' => $beautystore_options_pages, ) ); /** Front About Area */ $wp_customize->add_section( 'beautystore_about_settings', array( 'title' => __( 'About Section', 'beautystore' ), 'priority' => 20, 'panel' => 'beautystore_home_page_settings', ) ); $wp_customize->add_setting( 'beautystore_ed_about_section', array( 'default' => '', 'sanitize_callback' => 'beautystore_sanitize_checkbox', ) ); $wp_customize->add_control( 'beautystore_ed_about_section', array( 'label' => __( 'Enable About Section', 'beautystore' ), 'section' => 'beautystore_about_settings', 'type' => 'checkbox', ) ); $wp_customize->add_setting( 'beautystore_about_post', array( 'default' => '', 'sanitize_callback' => 'beautystore_sanitize_select', ) ); $wp_customize->add_control( 'beautystore_about_post', array( 'label' => __( 'Select About Section Page', 'beautystore' ), 'section' => 'beautystore_about_settings', 'type' => 'select', 'choices' => $beautystore_options_pages, ) ); $wp_customize->add_setting( 'beautystore_callout_post', array( 'default' => '', 'sanitize_callback' => 'beautystore_sanitize_select', ) ); $wp_customize->add_control( 'beautystore_callout_post', array( 'label' => __( 'Select Callout Section Page', 'beautystore' ), 'section' => 'beautystore_callout_settings', 'type' => 'select', 'choices' => $beautystore_options_pages, ) ); /** Front page Latest News */ $wp_customize->add_section( 'beautystore_service_settings', array( 'title' => __( 'Blog Section', 'beautystore' ), 'priority' => 40, 'panel' => 'beautystore_home_page_settings', ) ); $wp_customize->add_setting( 'beautystore_ed_service_section', array( 'default' => true, 'sanitize_callback' => 'beautystore_sanitize_checkbox', ) ); $wp_customize->add_control( 'beautystore_ed_service_section', array( 'label' => __( 'Enable Blog Section', 'beautystore' ), 'section' => 'beautystore_service_settings', 'type' => 'checkbox', ) ); /** Footer Area Settings */ $wp_customize->add_section( 'beautystore_footer_section', array( 'title' => __( 'Footer Settings', 'beautystore' ), 'priority' => 70, ) ); $wp_customize->add_setting( 'beautystore_footer_copyright_text', array( 'default' => '', 'sanitize_callback' => 'wp_kses_post', ) ); $wp_customize->add_control( 'beautystore_footer_copyright_text', array( 'label' => __( 'Copyright Info', 'beautystore' ), 'section' => 'beautystore_footer_section', 'type' => 'textarea', ) ); function beautystore_sanitize_checkbox( $checked ){ return ( ( isset( $checked ) && true == $checked ) ? true : false ); } function beautystore_sanitize_nohtml( $nohtml ){ return wp_filter_nohtml_kses( $nohtml ); } function beautystore_sanitize_html( $html ){ return wp_filter_post_kses( $html ); } function beautystore_sanitize_select( $input, $setting ){ $input = sanitize_key( $input ); $choices = $setting->manager->get_control( $setting->id )->choices; return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } function beautystore_sanitize_url( $url ){ return esc_url_raw( $url ); } } add_action( 'customize_register', 'beautystore_customize_register' ); endif; function beautystore_customize_preview_js() { $build = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '/build' : ''; wp_enqueue_script( 'beautystore_customizer', get_template_directory_uri() . '/assets/js' . $build . '/customizer.js', array( 'customize-preview' ), '20130508', true ); } add_action( 'customize_preview_init', 'beautystore_customize_preview_js' );