esc_html__('Copyright Text 2022','blogtech'), 'blogtech-back-to-top-option' =>0, ); return apply_filters( 'blogtech_default_theme_options', $default_theme_options ); } endif; if ( !function_exists('blogtech_get_theme_options') ) : function blogtech_get_theme_options() { $blogtech_default_theme_options = blogtech_default_theme_options(); $blogtech_get_theme_options = get_theme_mod( 'blogtech_theme_options'); if( is_array( $blogtech_get_theme_options )){ return array_merge( $blogtech_default_theme_options, $blogtech_get_theme_options ); } else{ return $blogtech_default_theme_options; } } endif; function blogtech_sanitize_checkbox( $checked ) { // Boolean check. return ( ( isset( $checked ) && true == $checked ) ? true : false ); } function blogtech_customize_register( $wp_customize ) { $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $default = blogtech_default_theme_options(); /* Footer Copyright */ $wp_customize->add_section( 'blogtech-footer-option', array( 'priority' => 110, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( 'Footer Options', 'blogtech' ) ) ); $wp_customize->add_setting( 'blogtech_theme_options[blogtech-footer-copyright]', array( 'capability' => 'edit_theme_options', 'default' => $default['blogtech-footer-copyright'], 'sanitize_callback' => 'wp_kses_post' ) ); $wp_customize->add_control( 'blogtech-footer-copyright', array( 'label' => __( 'Copyright Text', 'blogtech' ), 'description' => __('Your Own Copyright Text', 'blogtech'), 'section' => 'blogtech-footer-option', 'settings' => 'blogtech_theme_options[blogtech-footer-copyright]', 'type' => 'text', 'priority' => 10 ) ); /*Back To Top */ $wp_customize->add_section( 'blogtech-back-to-top', array( 'priority' => 110, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( 'Back To Top', 'blogtech' ) ) ); $wp_customize->add_setting( 'blogtech_theme_options[blogtech-back-to-top-option]', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'blogtech_sanitize_checkbox' ) ); $wp_customize->add_control( 'blogtech-back-to-top-option', array( 'label' => __( 'Enable Back to Top', 'blogtech' ), 'section' => 'blogtech-back-to-top', 'settings' => 'blogtech_theme_options[blogtech-back-to-top-option]', 'type' => 'checkbox', 'priority' => 10 ) ); if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'blogtech_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'blogtech_customize_partial_blogdescription', ) ); } } add_action( 'customize_register', 'blogtech_customize_register' ); /** * Render the site title for the selective refresh partial. * * @return void */ function blogtech_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site tagline for the selective refresh partial. * * @return void */ function blogtech_customize_partial_blogdescription() { bloginfo( 'description' ); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function blogtech_customize_preview_js() { wp_enqueue_script( 'blogtech-customizer', get_template_directory_uri() . '/assets/js/customizer.js', array( 'customize-preview' ), blogtech_version, true ); } add_action( 'customize_preview_init', 'blogtech_customize_preview_js' );