get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; /* create panel */ $wp_customize->add_panel( 'astn_theme_option', array( 'title' => __( 'Theme Settings', 'astn' ), 'priority' => 1, // Mixed with top-level-section hierarchy. ) ); /* general section */ $wp_customize->add_section( 'astn_general_settings', array( 'title' => __( 'General Settings', 'astn' ), 'panel' => 'astn_theme_option', 'capability' => 'edit_theme_options', 'priority' => 35, ) ); $wp_customize->add_setting( 'astn_frontpage_show', array( 'type' => 'theme_mod', 'default' => '', 'sanitize_callback' => 'astn_sanitize_checkbox', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'astn_frontpage_show', array( 'label' => __( 'Frontpage Template', 'astn' ), 'description' => __( 'Click to show the frontpage template?', 'astn' ), 'type' => 'checkbox', 'section' => 'astn_general_settings', 'settings' => 'astn_frontpage_show', ) ); /* header section */ $wp_customize->add_section( 'astn_header', array( 'title' => __( 'Header Settings', 'astn' ), 'panel' => 'astn_theme_option', 'capability' => 'edit_theme_options', 'priority' => 34, ) ); /* footer section */ $wp_customize->add_section( 'astn_footer', array( 'title' => __( 'Footer Options', 'astn' ), 'panel' => 'astn_theme_option', 'capability' => 'edit_theme_options', 'priority' => 35, ) ); $wp_customize->add_setting( 'astn_footer_toggle', array( 'type' => 'theme_mod', 'default' => '1', 'sanitize_callback' => 'astn_sanitize_checkbox' ) ); $wp_customize->add_setting( 'footer_text', array( 'type' => 'theme_mod', 'default' => '', 'sanitize_callback' => 'wp_filter_nohtml_kses', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'footer_text', array( 'label' => __( 'Footer Text', 'astn' ), 'type' => 'text', 'section' => 'astn_footer', 'settings' => 'footer_text', ) ); $wp_customize->add_setting( 'footer_copyright', array( 'type' => 'theme_mod', 'default' => '', 'sanitize_callback' => 'wp_filter_nohtml_kses', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'footer_copyright', array( 'label' => __( 'Footer Copyright', 'astn' ), 'type' => 'text', 'section' => 'astn_footer', 'settings' => 'footer_copyright', ) ); $wp_customize->add_setting( 'footer_link', array( 'type' => 'theme_mod', 'default' => '', 'sanitize_callback' => 'esc_url_raw', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'footer_link', array( 'label' => __( 'Footer Link', 'astn' ), 'type' => 'url', 'section' => 'astn_footer', 'settings' => 'footer_link', ) ); /* inner header image */ $wp_customize->add_section( 'astn_inner_banner', array( 'title' => __( 'Inner banner', 'astn' ), 'panel' => 'astn_theme_option', 'capability' => 'edit_theme_options', 'priority' => 35, ) ); $wp_customize->add_setting( 'inner_header_image', array( 'type' => 'theme_mod', 'default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'inner_header_image', array( 'label' => __( 'Inner banner Image', 'astn' ), 'description' => __( 'background image show before breadcrumb area', 'astn' ), 'section' => 'astn_inner_banner', 'settings' => 'inner_header_image' ) ) ); /* Slider options */ $wp_customize->add_section( 'slider_section', array( 'title' => __( 'Slider Options', 'astn' ), 'panel' => 'astn_theme_option', 'description' => 'Here you can add slider images', 'capability' => 'edit_theme_options', 'priority' => 35, 'active_callback' => 'is_front_page', ) ); for($i=1;$i<=3;$i++) { $wp_customize->add_setting( 'astn_dropdown_pages_'.$i, array( 'type' => 'theme_mod', 'default' => '', 'sanitize_callback' => 'absint', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'astn_dropdown_pages_'.$i, array( 'label' => 'Select page for slider '.$i, 'description' => esc_html__( 'Add Featured image in page' ,'astn' ), 'section' => 'slider_section', 'type' => 'dropdown-pages', ) ); } /* about section */ $wp_customize->add_section( 'astn_about', array( 'title' => __( 'About Us Section', 'astn' ), 'panel' => 'astn_theme_option', 'capability' => 'edit_theme_options', 'priority' => 35, ) ); $wp_customize->add_setting( 'astn_about_show', array( 'type' => 'theme_mod', 'default' => '', 'sanitize_callback' => 'astn_sanitize_checkbox', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'astn_about_show', array( 'label' => __( 'About Section On/Off', 'astn' ), 'description' => __( 'Click above checkbox to show about section on front page', 'astn' ), 'type' => 'checkbox', 'section' => 'astn_about', 'settings' => 'astn_about_show', ) ); $wp_customize->add_setting( 'astn_about_section', array( 'type' => 'theme_mod', 'default' => '', 'sanitize_callback' => 'absint', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'astn_about_section', array( 'label' => __( 'Select about us page','astn' ), 'description' => esc_html__( 'Select page to show on about us section on frontpage template', 'astn' ), 'section' => 'astn_about', 'type' => 'dropdown-pages', ) ); /* service section */ $wp_customize->add_section( 'astn_service', array( 'title' => __( 'Service Settings', 'astn' ), 'panel' => 'astn_theme_option', 'capability' => 'edit_theme_options', 'priority' => 35, ) ); $wp_customize->add_setting( 'astn_service_show', array( 'type' => 'theme_mod', 'default' => '', 'sanitize_callback' => 'astn_sanitize_checkbox', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'astn_service_show', array( 'label' => __( 'Service Section On/Off', 'astn' ), 'description' => __( 'Click above checkbox to show service section on front page', 'astn' ), 'type' => 'checkbox', 'section' => 'astn_service', 'settings' => 'astn_service_show', ) ); $wp_customize->add_setting( 'astn_service_title', array( 'type' => 'theme_mod', 'default' => '', 'sanitize_callback' => 'wp_filter_nohtml_kses', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'astn_service_title', array( 'label' => __( 'Service Title ', 'astn' ), 'type' => 'text', 'section' => 'astn_service', 'settings' => 'astn_service_title', ) ); $wp_customize->add_setting( 'astn_service_desc', array( 'type' => 'theme_mod', 'default' => '', 'sanitize_callback' => 'wp_filter_nohtml_kses', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'astn_service_desc', array( 'label' => __( 'Service description ', 'astn' ), 'type' => 'text', 'section' => 'astn_service', 'settings' => 'astn_service_desc', ) ); /* */ for($j=1;$j<=3;$j++) { $wp_customize->add_setting( 'astn_service_'.$j, array( 'type'=>'theme_mod', 'default'=>'', 'sanitize_callback'=>'absint', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( new astn_service( $wp_customize, 'astn_service_'.$j, array( 'label' => 'Select post for service '.$j, 'section' => 'astn_service', 'settings' => 'astn_service_'.$j, ) ) ); } /* */ /* blog section */ $wp_customize->add_section( 'astn_blog', array( 'title' => __( 'Blog Options', 'astn' ), 'panel' => 'astn_theme_option', 'capability' => 'edit_theme_options', 'priority' => 35, ) ); $wp_customize->add_setting( 'astn_blog_title', array( 'type' => 'theme_mod', 'default' => '', 'sanitize_callback' => 'wp_filter_nohtml_kses', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'astn_blog_title', array( 'label' => __( 'Blog Title ', 'astn' ), 'type' => 'text', 'section' => 'astn_blog', 'settings' => 'astn_blog_title', ) ); $wp_customize->add_setting( 'astn_blog_desc', array( 'type' => 'theme_mod', 'default' => '', 'sanitize_callback' => 'wp_filter_nohtml_kses', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'astn_blog_desc', array( 'label' => __( 'Blog description ', 'astn' ), 'type' => 'text', 'section' => 'astn_blog', 'settings' => 'astn_blog_desc', ) ); /* contact section */ $wp_customize->add_section( 'astn_contact', array( 'title' => __( 'Topbar Section', 'astn' ), 'description'=>__( 'Only Show on Topbar', 'astn' ), 'panel' => 'astn_theme_option', 'capability' => 'edit_theme_options', 'priority' => 35, ) ); $wp_customize->add_setting( 'astn_phoneno', array( 'type' => 'theme_mod', 'default' => '', 'sanitize_callback' => 'wp_filter_nohtml_kses', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'astn_phoneno', array( 'label' => __( 'Phone no. ', 'astn' ), 'type' => 'text', 'section' => 'astn_contact', 'settings' => 'astn_phoneno', ) ); $wp_customize->add_setting( 'astn_address', array( 'type' => 'theme_mod', 'default' => '', 'sanitize_callback' => 'wp_filter_nohtml_kses', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'astn_address', array( 'label' => __( 'Address ', 'astn' ), 'type' => 'text', 'section' => 'astn_contact', 'settings' => 'astn_address', ) ); $wp_customize->add_setting( 'astn_email', array( 'type' => 'theme_mod', 'default' => '', 'sanitize_callback' => 'wp_filter_nohtml_kses', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'astn_email', array( 'label' => __( 'Email ', 'astn' ), 'type' => 'email', 'section' => 'astn_contact', 'settings' => 'astn_email', ) ); function astn_sanitize_checkbox( $input ) { return $input; } //astn_Dropdown_Posts_Custom_Control } } new astn_Customizer();