get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->default = '#fff'; if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'container_inclusive' => false, 'render_callback' => 'academic_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'container_inclusive' => false, 'render_callback' => 'academic_customize_partial_blogdescription', ) ); } // Add panel for sections $wp_customize->add_panel( 'academic_sections_panel' , array( 'title' => esc_html__( 'Sections','academic' ), 'description'=> esc_html__( 'Section Options.', 'academic' ), 'priority' => 140, ) ); // top-bar require get_template_directory() . '/inc/customizer/sections/top-bar.php'; // Slider require get_template_directory() . '/inc/customizer/sections/slider.php'; // About require get_template_directory() . '/inc/customizer/sections/about.php'; // category blog one require get_template_directory() . '/inc/customizer/sections/category-blog-first.php'; // category blog second require get_template_directory() . '/inc/customizer/sections/category-blog-second.php'; // partner require get_template_directory() . '/inc/customizer/sections/partner.php'; // Add panel for common theme options $wp_customize->add_panel( 'academic_theme_options_panel' , array( 'title' => esc_html__( 'Theme Options','academic' ), 'description'=> esc_html__( 'Theme Options.', 'academic' ), 'priority' => 150, ) ); // load layout require get_template_directory() . '/inc/customizer/theme-options/layout.php'; // load static homepage option require get_template_directory() . '/inc/customizer/theme-options/homepage-static.php'; // load excerpt option require get_template_directory() . '/inc/customizer/theme-options/excerpt.php'; // load breadcrumb option require get_template_directory() . '/inc/customizer/theme-options/breadcrumb.php'; // load pagination option require get_template_directory() . '/inc/customizer/theme-options/pagination.php'; // load footer option require get_template_directory() . '/inc/customizer/theme-options/footer.php'; // load reset option require get_template_directory() . '/inc/customizer/theme-options/reset.php'; } add_action( 'customize_register', 'academic_customize_register' ); /* * Load customizer sanitization functions. */ require get_template_directory() . '/inc/customizer/sanitize.php'; // Load customizer theme pro link require get_template_directory() . '/inc/customizer/upgrade-to-pro/class-customize.php'; /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function academic_customize_preview_js() { wp_enqueue_script( 'academic_customizer', get_template_directory_uri() . '/assets/js/customizer.min.js', array( 'customize-preview' ), '20151215', true ); } add_action( 'customize_preview_init', 'academic_customize_preview_js' ); if ( ! function_exists( 'academic_reset_options' ) ) : /** * Reset all options * * @since Academic 0.3 * * @param bool $checked Whether the reset is checked. * @return bool Whether the reset is checked. */ function academic_reset_options() { $options = academic_get_theme_options(); if ( true === $options['reset_options'] ) { // Reset custom theme options. set_theme_mod( 'academic_theme_options', array() ); // Reset custom header and backgrounds. remove_theme_mod( 'header_image' ); remove_theme_mod( 'header_image_data' ); remove_theme_mod( 'background_image' ); remove_theme_mod( 'background_color' ); } else { return false; } } endif; add_action( 'customize_save_after', 'academic_reset_options' ); if ( ! function_exists( 'academic_inline_css' ) ) : /* * Add inline css from customizer */ function academic_inline_css() { $options = academic_get_theme_options(); $css = ''; $header_text_color = get_header_textcolor(); /* * If no custom options for text are set, let's bail. * get_header_textcolor() options: Any hex value, 'blank' to hide text. Default: HEADER_TEXTCOLOR. */ if ( get_theme_support( 'custom-header', 'default-text-color' ) !== $header_text_color ) { // If we get this far, we have custom styles. Let's do this. // Has the text been hidden? if ( ! display_header_text() ) : $css .=' .site-title, .site-description { position: absolute; clip: rect(1px, 1px, 1px, 1px); }'; // If the user has set a custom color for the text use that. else : $css .=' .site-title a, #site-header .site-title a, .site-description { color: #'.esc_attr( $header_text_color ).'; }'; endif; } wp_add_inline_style( 'academic-style', $css ); } endif; add_action( 'wp_enqueue_scripts', 'academic_inline_css', 10 );