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' => 'onward_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'onward_customize_partial_blogdescription', ) ); } /** Theme Options Main Panel */ $wp_customize->add_panel( 'onward_themeoptions', array( 'priority' => 222, 'theme_supports' => '', 'title' => esc_html__( 'Theme Settings', 'onward' ), ) ); $wp_customize->add_section( 'onward_container', array( 'title' => esc_html__( 'Container', 'onward' ), 'priority' => 1, 'panel' => 'onward_themeoptions', ) ); $wp_customize->add_setting( 'onward_container_size', array( 'default' => onward_defaults( 'onward_container_size' ), 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'onward_container_size', array( 'label' => esc_html__( 'Desktop Container', 'onward' ), 'priority' => 1, 'type' => 'text', 'section' => 'onward_container', 'settings' => 'onward_container_size' ) ); $wp_customize->add_setting( 'onward_container_size_a', array( 'default' => onward_defaults( 'onward_container_size_a' ), 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'onward_container_size_a', array( 'label' => esc_html__( 'Breakpint in 1280px', 'onward' ), 'priority' => 1, 'type' => 'text', 'section' => 'onward_container', 'settings' => 'onward_container_size_a' ) ); $wp_customize->add_setting( 'onward_container_size_b', array( 'default' => onward_defaults( 'onward_container_size_b' ), 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'onward_container_size_b', array( 'label' => esc_html__( 'Breakpint in 960px', 'onward' ), 'priority' => 1, 'type' => 'text', 'section' => 'onward_container', 'settings' => 'onward_container_size_b' ) ); $wp_customize->add_setting( 'onward_container_size_c', array( 'default' => onward_defaults( 'onward_container_size_c' ), 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'onward_container_size_c', array( 'label' => esc_html__( 'Breakpint in 760px', 'onward' ), 'priority' => 1, 'type' => 'text', 'section' => 'onward_container', 'settings' => 'onward_container_size_c' ) ); $wp_customize->add_setting( 'onward_container_size_d', array( 'default' => onward_defaults( 'onward_container_size_d' ), 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'onward_container_size_d', array( 'label' => esc_html__( 'Breakpint in 480px', 'onward' ), 'priority' => 1, 'type' => 'text', 'section' => 'onward_container', 'settings' => 'onward_container_size_d' ) ); $wp_customize->add_section( 'onward_main_color_section', array( 'title' => esc_html__( 'Colors', 'onward' ), 'priority' => 3, 'panel' => 'onward_themeoptions', ) ); $wp_customize->add_setting( 'onward_main_color', array( 'default' => onward_defaults( 'onward_main_color' ), 'sanitize_callback' => 'sanitize_hex_color' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'onward_main_color', array( 'label' => esc_html__( 'Main Color', 'onward' ), 'priority' => 1, 'section' => 'onward_main_color_section', 'settings' => 'onward_main_color' ) ) ); $onward_color = $wp_customize->get_section( 'colors' ); if ( is_object( $onward_color ) ) { $onward_color->title = __( 'Colors & Dark Mode', 'onward' ); } /** Theme Options >> Inner Sections >> Typography */ // $section_description = '

'; // $section_description .= sprintf( // 'You should put the CSS properties %2$s', // esc_url( __( 'https://modernaweb.net/onward/css/', 'onward') ), __( 'Learn more', 'onward'), // ); // $section_description .= '

'; // $wp_customize->add_section( // 'onward_typography_css_section', // array( // 'title' => esc_html__( 'Typography CSS', 'onward' ), // 'priority' => 5, // 'panel' => 'onward_themeoptions', // 'description' => $section_description, // ) // ); // $wp_customize->add_setting( // 'onward_heading_css_settings', // array( // 'default' => onward_defaults( 'onward_heading_css_settings' ), // 'sanitize_callback' => '' // ) // ); // $wp_customize->add_control( // new WP_Customize_Code_Editor_Control( // $wp_customize, // 'onward_heading_css_settings', // array( // 'label' => esc_html__( 'All Heading Declarations CSS', 'onward' ), // 'description' => '', // 'code_type' => 'text/css', // 'section' => 'onward_typography_css_section', // 'settings' => 'onward_heading_css_settings' // ) // ) // ); $wp_customize->add_section( 'onward_footer_section', array( 'title' => esc_html__( 'Footer', 'onward' ), 'priority' => 9, 'panel' => 'onward_themeoptions', ) ); $wp_customize->add_setting( 'onward_footer_top', array( 'default' => onward_defaults( 'onward_footer_top' ), 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'onward_footer_top', array( 'label' => esc_html__( 'Footer Copyright Text', 'onward' ), 'priority' => 1, 'type' => 'text', 'section' => 'onward_footer_section', 'settings' => 'onward_footer_top' ) ); $wp_customize->add_setting( 'onward_footer_name', array( 'default' => onward_defaults( 'onward_footer_name' ), 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'onward_footer_name', array( 'label' => esc_html__( 'Website Name', 'onward' ), 'priority' => 2, 'type' => 'text', 'section' => 'onward_footer_section', 'settings' => 'onward_footer_name' ) ); $wp_customize->add_setting( 'onward_footer_url', array( 'default' => onward_defaults( 'onward_footer_url' ), 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'onward_footer_url', array( 'label' => esc_html__( 'Website Name', 'onward' ), 'priority' => 2, 'type' => 'text', 'section' => 'onward_footer_section', 'settings' => 'onward_footer_url' ) ); $wp_customize->add_setting( 'onward_footer_back_to_top', array( 'default' => onward_defaults( 'onward_footer_back_to_top' ), 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'onward_footer_back_to_top', array( 'label' => esc_html__( 'Back To Top Text', 'onward' ), 'priority' => 3, 'type' => 'text', 'section' => 'onward_footer_section', 'settings' => 'onward_footer_back_to_top' ) ); } add_action( 'customize_register', 'onward_customize_register' ); /** * Render the site title for the selective refresh partial. * * @return void */ function onward_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site tagline for the selective refresh partial. * * @return void */ function onward_customize_partial_blogdescription() { bloginfo( 'description' ); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function onward_customize_preview_js() { wp_enqueue_script( 'onward-customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), _S_VERSION, true ); } add_action( 'customize_preview_init', 'onward_customize_preview_js' );