get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'aimbot_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'aimbot_customize_partial_blogdescription', ) ); // adding copyright section to the aimbot customizer $wp_customize-> add_section('aimbot_copyright_sec', array( 'title' => __('Copyright','aimbot'), 'description' => __('Please, type here your copyright','aimbot') )); $wp_customize-> add_setting('aimbot_copyright_set', array( 'type' => 'theme_mod', 'sanitize_callback' => 'esc_html' )); $wp_customize-> add_control( 'aimbot_ctrl_copyright', array( 'label' => __('Copyright Information','aimbot'), 'description' => __('Please, type your copyright here.','aimbot'), 'section' => 'aimbot_copyright_sec', 'settings' => 'aimbot_copyright_set', 'type' => 'text' )); // adding footer column choice $wp_customize-> add_section('aimbot_foot_col_choice_sc', array( 'title' => __('Footer Column Choice','aimbot'), 'description' => __('Please, choose your Footer Column Layout','aimbot') )); $wp_customize-> add_setting('aimbot_foot_col_choice_st', array( 'type' => 'theme_mod', 'sanitize_callback' => 'aimbot_sanitize_foot_col_choice' )); $wp_customize-> add_control( 'aimbot_foot_col_choice_ctrl', array( 'label' => __('Footer Column Choice','aimbot'), 'description' => __('Please, choose your Footer Column Layout','aimbot'), 'section' => 'aimbot_foot_col_choice_sc', 'settings' => 'aimbot_foot_col_choice_st', 'type' => 'select', 'choices' => array( 'two' => __( 'Two Column','aimbot' ), 'three' => __( 'Three Column','aimbot' ), 'four' => __( 'Four Column','aimbot' ), ), )); // sanitizing footer column choice function aimbot_sanitize_foot_col_choice($input, $setting) { $choices = array('two','three','four'); if (in_array($input, $choices)) { return $input; } else { return "three"; } } // adding sidebar location setting to customizer $wp_customize-> add_section('aimbot_sidebar_sec', array( 'title' => __('Sidebar Location','aimbot'), 'description' => __('Please, choose your sidebar location','aimbot'), )); $wp_customize-> add_setting('aimbot_sidebar_set', array( 'type' => 'theme_mod', 'sanitize_callback' => 'aimbot_sanitize_sidebar' )); $wp_customize-> add_control( 'aimbot_ctrl_sidebar', array( 'label' => __('Sidebar Location','aimbot'), 'description' => __('Please, choose your sidebar location','aimbot'), 'section' => 'aimbot_sidebar_sec', 'settings' => 'aimbot_sidebar_set', 'type' => 'select', 'choices' => array( 'left' => __( 'Left Side' ,'aimbot'), 'right' => __( 'Right Side','aimbot' ), 'none' => __( 'Full Width','aimbot' ), ), )); function aimbot_sanitize_sidebar($input, $setting) { $choices = array('right', 'left','none'); if (in_array($input, $choices)) { return $input; } else { return "right"; } } } } add_action( 'customize_register', 'aimbot_customize_register' ); /** * Render the site title for the selective refresh partial. * * @return void */ function aimbot_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site tagline for the selective refresh partial. * * @return void */ function aimbot_customize_partial_blogdescription() { bloginfo( 'description' ); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function aimbot_customize_preview_js() { wp_enqueue_script( 'aimbot-customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), aimbot, true ); } add_action( 'customize_preview_init', 'aimbot_customize_preview_js' );