get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $wp_customize->get_section( 'static_front_page' )->priority = '25'; $wp_customize->get_section( 'title_tagline' )->panel = 'theme_header_option_panel'; $wp_customize->get_section( 'header_image' )->panel = 'theme_header_option_panel'; $wp_customize->get_section( 'colors' )->panel = 'global_option_panel'; $wp_customize->get_section( 'background_image' )->panel = 'global_option_panel'; require get_template_directory() . '/inc/customizer/common-option.php'; require get_template_directory() . '/inc/customizer/header-section.php'; $wp_customize->add_panel('theme_theme_option_panel', array( 'title' => esc_html__('Theme Options', 'blook'), 'priority' => 300, 'capability' => 'edit_theme_options', ) ); require get_template_directory() . '/inc/customizer/homepage-component-1.php'; require get_template_directory() . '/inc/customizer/homepage-component-2.php'; require get_template_directory() . '/inc/customizer/homepage-component-3.php'; require get_template_directory() . '/inc/customizer/homepage-component-4.php'; require get_template_directory() . '/inc/customizer/homepage-component-5.php'; $home_section_reorder_val = blook_get_option( 'home_section_reorder_val', $default['home_section_reorder_val'] ); $home_section_reorder_val = explode(",",$home_section_reorder_val ); $j = 1; foreach( $home_section_reorder_val as $home_section_reorder ){ if ($j <= 5) { $wp_customize->get_section( $home_section_reorder )->priority = $j; } $j ++; } require get_template_directory() . '/inc/customizer/breaking-news.php'; require get_template_directory() . '/inc/customizer/preloader.php'; require get_template_directory() . '/inc/customizer/pagination.php'; require get_template_directory() . '/inc/customizer/sidebar.php'; require get_template_directory() . '/inc/customizer/single.php'; require get_template_directory() . '/inc/customizer/archive.php'; require get_template_directory() . '/inc/customizer/social.php'; require get_template_directory() . '/inc/customizer/footer.php'; require get_template_directory() . '/inc/customizer/global-option.php'; } add_action( 'customize_register', 'blook_customize_register' ); add_action( 'wp_ajax_blook_reorder_home_section', 'blook_reorder_home_section' ); function blook_reorder_home_section() { if ( isset( $_POST['sections'] ) ) { set_theme_mod( 'home_section_reorder_val', wp_unslash( $_POST['sections'] ) ); } wp_die(); // this is required to terminate immediately and return a proper response } /** * Customizer Enqueue scripts and styles. */ if (!function_exists('blook_customizer_scripts')) : function blook_customizer_scripts(){ wp_enqueue_style( 'blook-customize-controll-style', get_template_directory_uri() . '/assets/css/customizer-controll.css' ); wp_enqueue_script('blook-re-customizer', get_template_directory_uri() . '/assets/js/re-customizer.js', array('jquery','customize-controls'), '', 1); $home_section_reorder_val = get_theme_mod( 'home_section_reorder_val' ); $home_section_reorder_val = explode(",",$home_section_reorder_val ); $key_sidebar = ''; $home_url = esc_url( home_url('/') ); $ajax_nonce = wp_create_nonce('blook_ajax_nonce'); wp_localize_script( 'blook-re-customizer', 'blook_re_customizer', array( 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), 'ajax_nonce' => $ajax_nonce, 'key_sidebar' => $key_sidebar, 'home_url' => $home_url, ) ); } endif; add_action('customize_controls_enqueue_scripts', 'blook_customizer_scripts'); add_action('customize_controls_init', 'blook_customizer_scripts'); /** * Render the site title for the selective refresh partial. * * @return void */ function blook_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site tagline for the selective refresh partial. * * @return void */ function blook_customize_partial_blogdescription() { bloginfo( 'description' ); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function blook_customize_preview_js() { wp_enqueue_script( 'blook-customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), _S_VERSION, true ); } add_action( 'customize_preview_init', 'blook_customize_preview_js' );