ID] = $book_landing_page_posts->post_title; } /* Option list of all categories */ $book_landing_page_args = array( 'type' => 'post', 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 1, 'hierarchical' => 1, 'taxonomy' => 'category' ); $book_landing_page_option_categories = array(); $book_landing_page_category_lists = get_categories( $book_landing_page_args ); $book_landing_page_option_categories[''] = __( 'Choose Category', 'book-landing-page' ); foreach( $book_landing_page_category_lists as $book_landing_page_category ){ $book_landing_page_option_categories[$book_landing_page_category->term_id] = $book_landing_page_category->name; } /** Default Settings */ $wp_customize->add_panel( 'wp_default_panel', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( 'Default Settings', 'book-landing-page' ), 'description' => __( 'Default section provided by wordpress customizer.', 'book-landing-page' ), ) ); $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 = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; /** Home Page Settings */ $wp_customize->add_panel( 'book_landing_page_home_page_settings', array( 'priority' => 40, 'capability' => 'edit_theme_options', 'title' => __( 'Home Page Settings', 'book-landing-page' ), 'description' => __( 'Customize Home Page Settings', 'book-landing-page' ), ) ); /** Banner Section */ $wp_customize->add_section( 'book_landing_page_banner_settings', array( 'title' => __( 'Banner Section', 'book-landing-page' ), 'priority' => 20, 'panel' => 'book_landing_page_home_page_settings', ) ); /** Enable/Disable Banner Section */ $wp_customize->add_setting( 'book_landing_page_ed_banner_section', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_checkbox', ) ); $wp_customize->add_control( 'book_landing_page_ed_banner_section', array( 'label' => __( 'Enable Banner Section', 'book-landing-page' ), 'section' => 'book_landing_page_banner_settings', 'type' => 'checkbox', ) ); /** Banner Section Title */ $wp_customize->add_setting( 'book_landing_page_banner_section_title', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_nohtml', ) ); $wp_customize->add_control( 'book_landing_page_banner_section_title', array( 'label' => __( 'Banner Section Title', 'book-landing-page' ), 'section' => 'book_landing_page_banner_settings', 'type' => 'text', ) ); /** Banner Section Content */ $wp_customize->add_setting( 'book_landing_page_banner_section_content', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_html', ) ); $wp_customize->add_control( 'book_landing_page_banner_section_content', array( 'label' => __( 'Banner Section Content', 'book-landing-page' ), 'section' => 'book_landing_page_banner_settings', 'type' => 'textarea', ) ); /** Upload a Image One */ $wp_customize->add_setting( 'book_landing_page_banner_one_image', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_number_absint', ) ); $wp_customize->add_control( new WP_Customize_Cropped_Image_Control( $wp_customize, 'book_landing_page_banner_one_image', array( 'label' => __( 'Upload a Image One', 'book-landing-page' ), 'section' => 'book_landing_page_banner_settings', 'width' => 300, 'height' => 468, ) ) ); /** banner Section Content */ $wp_customize->add_setting( 'book_landing_page_banner_section_button_link', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_nohtml', ) ); $wp_customize->add_control( 'book_landing_page_banner_section_button_link', array( 'label' => __( 'Banner Section Button Link', 'book-landing-page' ), 'section' => 'book_landing_page_banner_settings', 'type' => 'textarea', ) ); /** Promotional Section Button Text */ $wp_customize->add_setting( 'book_landing_page_banner_section_button_text', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_nohtml', ) ); $wp_customize->add_control( 'book_landing_page_banner_section_button_text', array( 'label' => __( 'Banner Section Button Text', 'book-landing-page' ), 'section' => 'book_landing_page_banner_settings', 'type' => 'text', ) ); /** Banner Section Ends */ /** About Block Section */ $wp_customize->add_section( 'book_landing_page_about_settings', array( 'title' => __( 'About Block Section', 'book-landing-page' ), 'priority' => 30, 'panel' => 'book_landing_page_home_page_settings', ) ); /** Enable/Disable About Section */ $wp_customize->add_setting( 'book_landing_page_ed_about_section', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_checkbox', ) ); $wp_customize->add_control( 'book_landing_page_ed_about_section', array( 'label' => __( 'Enable About Block Section', 'book-landing-page' ), 'section' => 'book_landing_page_about_settings', 'type' => 'checkbox', ) ); /** About Section Title */ $wp_customize->add_setting( 'book_landing_page_about_section_title', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_html', ) ); $wp_customize->add_control( 'book_landing_page_about_section_title', array( 'label' => __( 'About Section Title', 'book-landing-page' ), 'section' => 'book_landing_page_about_settings', 'type' => 'text', ) ); /** About Section Content */ $wp_customize->add_setting( 'book_landing_page_about_section_content', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_html', ) ); $wp_customize->add_control( 'book_landing_page_about_section_content', array( 'label' => __( 'About Section Content', 'book-landing-page' ), 'section' => 'book_landing_page_about_settings', 'type' => 'textarea', ) ); /** About Post One */ $wp_customize->add_setting( 'book_landing_page_about_block_one', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_select', ) ); $wp_customize->add_control( 'book_landing_page_about_block_one', array( 'label' => __( 'Select About Post One', 'book-landing-page' ), 'section' => 'book_landing_page_about_settings', 'type' => 'select', 'choices' => $book_landing_page_options_posts, ) ); /** About Post Two */ $wp_customize->add_setting( 'book_landing_page_about_block_two', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_select', ) ); $wp_customize->add_control( 'book_landing_page_about_block_two', array( 'label' => __( 'Select About Post Two', 'book-landing-page' ), 'section' => 'book_landing_page_about_settings', 'type' => 'select', 'choices' => $book_landing_page_options_posts, ) ); /** About Post Three */ $wp_customize->add_setting( 'book_landing_page_about_block_three', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_select', ) ); $wp_customize->add_control( 'book_landing_page_about_block_three', array( 'label' => __( 'Select About Post Three', 'book-landing-page' ), 'section' => 'book_landing_page_about_settings', 'type' => 'select', 'choices' => $book_landing_page_options_posts, ) ); /** About Post Four */ $wp_customize->add_setting( 'book_landing_page_about_block_four', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_select', ) ); $wp_customize->add_control( 'book_landing_page_about_block_four', array( 'label' => __( 'Select About Post Four', 'book-landing-page' ), 'section' => 'book_landing_page_about_settings', 'type' => 'select', 'choices' => $book_landing_page_options_posts, ) ); /** About Post Five */ $wp_customize->add_setting( 'book_landing_page_about_block_five', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_select', ) ); $wp_customize->add_control( 'book_landing_page_about_block_five', array( 'label' => __( 'Select About Post Five', 'book-landing-page' ), 'section' => 'book_landing_page_about_settings', 'type' => 'select', 'choices' => $book_landing_page_options_posts, ) ); /** About Post Six */ $wp_customize->add_setting( 'book_landing_page_about_block_six', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_select', ) ); $wp_customize->add_control( 'book_landing_page_about_block_six', array( 'label' => __( 'Select About Post Six', 'book-landing-page' ), 'section' => 'book_landing_page_about_settings', 'type' => 'select', 'choices' => $book_landing_page_options_posts, ) ); /** About Block Section Ends */ /** Testimonial Settings */ $wp_customize->add_section( 'book_landing_page_testimonial_settings', array( 'title' => __( 'Testimonial Section', 'book-landing-page' ), 'priority' => 40, 'panel' => 'book_landing_page_home_page_settings', ) ); /** Enable/Disable Testimonial Section */ $wp_customize->add_setting( 'book_landing_page_ed_testimonial_section', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_checkbox', ) ); $wp_customize->add_control( 'book_landing_page_ed_testimonial_section', array( 'label' => __( 'Enable Testimonial Section', 'book-landing-page' ), 'section' => 'book_landing_page_testimonial_settings', 'type' => 'checkbox', ) ); /** Testimonial Section Title */ $wp_customize->add_setting( 'book_landing_page_testimonial_section_title', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_nohtml', ) ); $wp_customize->add_control( 'book_landing_page_testimonial_section_title', array( 'label' => __( 'Testimonial Section Title', 'book-landing-page' ), 'section' => 'book_landing_page_testimonial_settings', 'type' => 'text', ) ); /** Testimonial Section Content */ $wp_customize->add_setting( 'book_landing_page_testimonial_section_content', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_html', ) ); $wp_customize->add_control( 'book_landing_page_testimonial_section_content', array( 'label' => __( 'Testimonial Section Content', 'book-landing-page' ), 'section' => 'book_landing_page_testimonial_settings', 'type' => 'textarea', ) ); /** Testimonial Post One */ $wp_customize->add_setting( 'book_landing_page_testimonial_block_one', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_select', ) ); $wp_customize->add_control( 'book_landing_page_testimonial_block_one', array( 'label' => __( 'Select Testimonial Post One', 'book-landing-page' ), 'section' => 'book_landing_page_testimonial_settings', 'type' => 'select', 'choices' => $book_landing_page_options_posts, ) ); /** Testimonial Post Two */ $wp_customize->add_setting( 'book_landing_page_testimonial_block_two', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_select', ) ); $wp_customize->add_control( 'book_landing_page_testimonial_block_two', array( 'label' => __( 'Select Testimonial Post Two', 'book-landing-page' ), 'section' => 'book_landing_page_testimonial_settings', 'type' => 'select', 'choices' => $book_landing_page_options_posts, ) ); /** Testimonial Section Ends */ /** Review Section */ $wp_customize->add_section( 'book_landing_page_review_settings', array( 'title' => __( 'Review Section', 'book-landing-page' ), 'priority' => 50, 'panel' => 'book_landing_page_home_page_settings', ) ); /** Enable/Disable Review Section */ $wp_customize->add_setting( 'book_landing_page_ed_review_section', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_checkbox', ) ); $wp_customize->add_control( 'book_landing_page_ed_review_section', array( 'label' => __( 'Enable Review Section', 'book-landing-page' ), 'section' => 'book_landing_page_review_settings', 'type' => 'checkbox', ) ); /** Review Section Title */ $wp_customize->add_setting( 'book_landing_page_review_section_title', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_nohtml', ) ); $wp_customize->add_control( 'book_landing_page_review_section_title', array( 'label' => __( 'Review Section Title', 'book-landing-page' ), 'section' => 'book_landing_page_review_settings', 'type' => 'text', ) ); /** Review Section Content */ $wp_customize->add_setting( 'book_landing_page_review_section_content', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_html', ) ); $wp_customize->add_control( 'book_landing_page_review_section_content', array( 'label' => __( 'Review Section Content', 'book-landing-page' ), 'section' => 'book_landing_page_review_settings', 'type' => 'textarea', ) ); /** Review Video Link */ $wp_customize->add_setting( 'book_landing_page_review_video', array( 'default' => __( '', 'book-landing-page' ), 'sanitize_callback' => 'wp_kses_stripslashes', ) ); $wp_customize->add_control( 'book_landing_page_review_video', array( 'label' => __( 'Review Video Embed Link', 'book-landing-page' ), 'section' => 'book_landing_page_review_settings', 'type' => 'text', ) ); /** Review Section Title */ $wp_customize->add_setting( 'book_landing_page_review_section_video_title', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_nohtml', ) ); $wp_customize->add_control( 'book_landing_page_review_section_video_title', array( 'label' => __( 'Review Video Title', 'book-landing-page' ), 'section' => 'book_landing_page_review_settings', 'type' => 'text', ) ); /** Review Section Content */ $wp_customize->add_setting( 'book_landing_page_review_section_video_content', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_html', ) ); $wp_customize->add_control( 'book_landing_page_review_section_video_content', array( 'label' => __( 'Review video Description', 'book-landing-page' ), 'section' => 'book_landing_page_review_settings', 'type' => 'textarea', ) ); /** Review Section Ends */ /** Tabber Menu Settings */ $wp_customize->add_section( 'book_landing_page_tabmenu_settings', array( 'title' => __( 'Tabber Menu Settings', 'book-landing-page' ), 'priority' => 50, 'panel' => 'book_landing_page_home_page_settings', ) ); /** Enable/Disable Tabber Menu */ $wp_customize->add_setting( 'book_landing_page_ed_tabmenu_section', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_checkbox', ) ); $wp_customize->add_control( 'book_landing_page_ed_tabmenu_section', array( 'label' => __( 'Enable Tabber Menu', 'book-landing-page' ), 'section' => 'book_landing_page_tabmenu_settings', 'type' => 'checkbox', ) ); /** Tabber Menu Section Title */ $wp_customize->add_setting( 'book_landing_page_tabmenu_section_title', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_nohtml', ) ); $wp_customize->add_control( 'book_landing_page_tabmenu_section_title', array( 'label' => __( 'Tabber Menu Section Title', 'book-landing-page' ), 'section' => 'book_landing_page_tabmenu_settings', 'type' => 'text', ) ); /** Tabber Menu Section Content */ $wp_customize->add_setting( 'book_landing_page_tabmenu_section_content', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_html', ) ); $wp_customize->add_control( 'book_landing_page_tabmenu_section_content', array( 'label' => __( 'Tabber Menu Section Content', 'book-landing-page' ), 'section' => 'book_landing_page_tabmenu_settings', 'type' => 'textarea', ) ); /** Select Tabber Category */ $wp_customize->add_setting( 'book_landing_page_tabmenu_section_cat', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_select', ) ); $wp_customize->add_control( 'book_landing_page_tabmenu_section_cat', array( 'label' => __( 'Select Category', 'book-landing-page' ), 'section' => 'book_landing_page_tabmenu_settings', 'type' => 'select', 'choices' => $book_landing_page_option_categories, ) ); /** Background Image */ $wp_customize->add_setting( 'book_landing_page_tabmenu_section_bg', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_image', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'book_landing_page_tabmenu_section_bg', array( 'label' => __( 'Background Image', 'book-landing-page' ), 'section' => 'book_landing_page_tabmenu_settings' ) ) ); /** Tabber Menu Section Ends */ /** Author Section */ $wp_customize->add_section( 'book_landing_page_author_settings', array( 'title' => __( 'Author Section', 'book-landing-page' ), 'priority' => 50, 'panel' => 'book_landing_page_home_page_settings', ) ); /** Enable/Disable Author Section */ $wp_customize->add_setting( 'book_landing_page_ed_author_section', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_checkbox', ) ); $wp_customize->add_control( 'book_landing_page_ed_author_section', array( 'label' => __( 'Enable Author Section', 'book-landing-page' ), 'section' => 'book_landing_page_author_settings', 'type' => 'checkbox', ) ); /** Author Section Title */ $wp_customize->add_setting( 'book_landing_page_author_section_title', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_nohtml', ) ); $wp_customize->add_control( 'book_landing_page_author_section_title', array( 'label' => __( 'Author Section Title', 'book-landing-page' ), 'section' => 'book_landing_page_author_settings', 'type' => 'text', ) ); /** Author Section Content */ $wp_customize->add_setting( 'book_landing_page_author_section_content', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_html', ) ); $wp_customize->add_control( 'book_landing_page_author_section_content', array( 'label' => __( 'Author Section Content', 'book-landing-page' ), 'section' => 'book_landing_page_author_settings', 'type' => 'textarea', ) ); /** Author Video Link */ $wp_customize->add_setting( 'book_landing_page_author_video', array( 'default' => __( '', 'book-landing-page' ), 'sanitize_callback' => 'wp_kses_stripslashes', ) ); $wp_customize->add_control( 'book_landing_page_author_video', array( 'label' => __( 'Author Video Embed Link', 'book-landing-page' ), 'section' => 'book_landing_page_author_settings', 'type' => 'text', ) ); /** Author Section Title */ $wp_customize->add_setting( 'book_landing_page_author_section_video_title', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_nohtml', ) ); $wp_customize->add_control( 'book_landing_page_author_section_video_title', array( 'label' => __( 'Author Video Title', 'book-landing-page' ), 'section' => 'book_landing_page_author_settings', 'type' => 'text', ) ); /** Author Section Content */ $wp_customize->add_setting( 'book_landing_page_author_section_video_content', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_html', ) ); $wp_customize->add_control( 'book_landing_page_author_section_video_content', array( 'label' => __( 'Author video Description', 'book-landing-page' ), 'section' => 'book_landing_page_author_settings', 'type' => 'textarea', ) ); /** Author Section Ends */ /** Promotional Section */ $wp_customize->add_section( 'book_landing_page_promotional_settings', array( 'title' => __( 'Promotional Section', 'book-landing-page' ), 'priority' => 50, 'panel' => 'book_landing_page_home_page_settings', ) ); /** Enable/Disable promotional Section */ $wp_customize->add_setting( 'book_landing_page_ed_promotional_section', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_checkbox', ) ); $wp_customize->add_control( 'book_landing_page_ed_promotional_section', array( 'label' => __( 'Enable Promotional Section', 'book-landing-page' ), 'section' => 'book_landing_page_promotional_settings', 'type' => 'checkbox', ) ); /** Promotional Section Title */ $wp_customize->add_setting( 'book_landing_page_promotional_section_title', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_nohtml', ) ); $wp_customize->add_control( 'book_landing_page_promotional_section_title', array( 'label' => __( 'Promotional Section Title', 'book-landing-page' ), 'section' => 'book_landing_page_promotional_settings', 'type' => 'text', ) ); /** Promotional Section Content */ $wp_customize->add_setting( 'book_landing_page_promotional_section_content', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_html', ) ); $wp_customize->add_control( 'book_landing_page_promotional_section_content', array( 'label' => __( 'Promotional Section Content', 'book-landing-page' ), 'section' => 'book_landing_page_promotional_settings', 'type' => 'textarea', ) ); /** Upload a Image One */ $wp_customize->add_setting( 'book_landing_page_promotional_one_image', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_number_absint', ) ); $wp_customize->add_control( new WP_Customize_Cropped_Image_Control( $wp_customize, 'book_landing_page_promotional_one_image', array( 'label' => __( 'Upload a Image One', 'book-landing-page' ), 'section' => 'book_landing_page_promotional_settings', 'width' => 263, 'height' => 468, ) ) ); /** Promotional Section Price */ $wp_customize->add_setting( 'book_landing_page_promotional_section_old_price', array( 'default' => 0, 'sanitize_callback' => 'book_landing_page_sanitize_nohtml', ) ); $wp_customize->add_control( 'book_landing_page_promotional_section_old_price', array( 'label' => __( 'Promotional Section Old Price', 'book-landing-page' ), 'section' => 'book_landing_page_promotional_settings', 'type' => 'text', ) ); /** Promotional Section Price */ $wp_customize->add_setting( 'book_landing_page_promotional_section_new_price', array( 'default' => 0, 'sanitize_callback' => 'book_landing_page_sanitize_nohtml', ) ); $wp_customize->add_control( 'book_landing_page_promotional_section_new_price', array( 'label' => __( 'Promotional Section New Price', 'book-landing-page' ), 'section' => 'book_landing_page_promotional_settings', 'type' => 'text', ) ); /** Promotional Section Price */ $wp_customize->add_setting( 'book_landing_page_promotional_section_buy_info', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_nohtml', ) ); $wp_customize->add_control( 'book_landing_page_promotional_section_buy_info', array( 'label' => __( 'Promotional Section Buy Info', 'book-landing-page' ), 'section' => 'book_landing_page_promotional_settings', 'type' => 'text', ) ); /** Promotional Section Content */ $wp_customize->add_setting( 'book_landing_page_promotional_section_button', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_nohtml', ) ); $wp_customize->add_control( 'book_landing_page_promotional_section_button', array( 'label' => __( 'Promotional Section Button Link', 'book-landing-page' ), 'section' => 'book_landing_page_promotional_settings', 'type' => 'textarea', ) ); /** Promotional Section Button Text */ $wp_customize->add_setting( 'book_landing_page_promotional_section_button_text', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_nohtml', ) ); $wp_customize->add_control( 'book_landing_page_promotional_section_button_text', array( 'label' => __( 'Promotional Section Button Text', 'book-landing-page' ), 'section' => 'book_landing_page_promotional_settings', 'type' => 'text', ) ); /** Promotional Section Ends */ /** Subscribe Settings */ $wp_customize->add_section( 'book_landing_page_subscribe_settings', array( 'title' => __( 'Subscribe Settings', 'book-landing-page' ), 'priority' => 50, 'panel' => 'book_landing_page_home_page_settings', ) ); /** Enable/Disable Subscribe */ $wp_customize->add_setting( 'book_landing_page_ed_subscribe_section', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_checkbox', ) ); $wp_customize->add_control( 'book_landing_page_ed_subscribe_section', array( 'label' => __( 'Enable Subscribe', 'book-landing-page' ), 'section' => 'book_landing_page_subscribe_settings', 'type' => 'checkbox', ) ); /** Subscribe Section Ends */ /** Home Page Settings Ends */ /** BreadCrumb Settings */ $wp_customize->add_section( 'book_landing_page_breadcrumb_settings', array( 'title' => __( 'Breadcrumb Settings', 'book-landing-page' ), 'priority' => 50, 'capability' => 'edit_theme_options', ) ); /** Enable/Disable BreadCrumb */ $wp_customize->add_setting( 'book_landing_page_ed_breadcrumb', array( 'default' => '', 'sanitize_callback' => 'book_landing_page_sanitize_checkbox', ) ); $wp_customize->add_control( 'book_landing_page_ed_breadcrumb', array( 'label' => __( 'Enable Breadcrumb', 'book-landing-page' ), 'section' => 'book_landing_page_breadcrumb_settings', 'type' => 'checkbox', ) ); /** Show/Hide Current */ $wp_customize->add_setting( 'book_landing_page_ed_current', array( 'default' => '1', 'sanitize_callback' => 'book_landing_page_sanitize_checkbox', ) ); $wp_customize->add_control( 'book_landing_page_ed_current', array( 'label' => __( 'Show current', 'book-landing-page' ), 'section' => 'book_landing_page_breadcrumb_settings', 'type' => 'checkbox', ) ); /** Home Text */ $wp_customize->add_setting( 'book_landing_page_breadcrumb_home_text', array( 'default' => __( 'Home', 'book-landing-page' ), 'sanitize_callback' => 'book_landing_page_sanitize_nohtml', ) ); $wp_customize->add_control( 'book_landing_page_breadcrumb_home_text', array( 'label' => __( 'Breadcrumb Home Text', 'book-landing-page' ), 'section' => 'book_landing_page_breadcrumb_settings', 'type' => 'text', ) ); /** Breadcrumb Separator */ $wp_customize->add_setting( 'book_landing_page_breadcrumb_separator', array( 'default' => __( '>', 'book-landing-page' ), 'sanitize_callback' => 'book_landing_page_sanitize_nohtml', ) ); $wp_customize->add_control( 'book_landing_page_breadcrumb_separator', array( 'label' => __( 'Breadcrumb Separator', 'book-landing-page' ), 'section' => 'book_landing_page_breadcrumb_settings', 'type' => 'text', ) ); /** BreadCrumb Settings Ends */ /** * Sanitization Functions * * @link https://github.com/WPTRT/code-examples/blob/master/customizer/sanitization-callbacks.php */ function book_landing_page_sanitize_checkbox( $checked ){ // Boolean check. return ( ( isset( $checked ) && true == $checked ) ? true : false ); } function book_landing_page_sanitize_nohtml( $nohtml ){ return wp_filter_nohtml_kses( $nohtml ); } function book_landing_page_sanitize_html( $html ){ return wp_filter_post_kses( $html ); } function book_landing_page_sanitize_select( $input, $setting ){ // Ensure input is a slug. $input = sanitize_key( $input ); // Get 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; otherwise, return the default. return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } function book_landing_page_sanitize_url( $url ){ return esc_url_raw( $url ); } function book_landing_page_sanitize_number_absint( $number, $setting ) { // Ensure $number is an absolute integer (whole number, zero or greater). $number = absint( $number ); // If the input is an absolute integer, return it; otherwise, return the default return ( $number ? $number : $setting->default ); } function book_landing_page_sanitize_shortcode( $shortcode ){ return wp_kses_post( $shortcode ); } function book_landing_page_sanitize_image( $image, $setting ) { /* * Array of valid image file types. * * The array includes image mime types that are included in wp_get_mime_types() */ $mimes = array( 'jpg|jpeg|jpe' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', 'bmp' => 'image/bmp', 'tif|tiff' => 'image/tiff', 'ico' => 'image/x-icon' ); // Return an array with file extension and mime_type. $file = wp_check_filetype( $image, $mimes ); // If $image has a valid mime_type, return it; otherwise, return the default. return ( $file['ext'] ? $image : $setting->default ); } } add_action( 'customize_register', 'book_landing_page_customize_register' ); /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function book_landing_page_customize_preview_js() { wp_enqueue_script( 'book_landing_page_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true ); } add_action( 'customize_preview_init', 'book_landing_page_customize_preview_js' );