( new Tripp_Customize_Unit_Control( $wp_customize, 'typography_h2_sizes', array( 'section' => 'typography_headings_section', 'label' => esc_html__( 'H2', 'tripp' ), 'placeholder' => esc_html__( 'Default', 'tripp' ), ) ) ); // Typography -> Headings -> H3. $wp_customize->add_setting( 'typography_h3_sizes', array( 'default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'tripp_customize_sanitize_sizes', ) ); $wp_customize->add_control( new Tripp_Customize_Unit_Control( $wp_customize, 'typography_h3_sizes', array( 'section' => 'typography_headings_section', 'label' => esc_html__( 'H3', 'tripp' ), 'placeholder' => esc_html__( 'Default', 'tripp' ), ) ) ); // Typography -> Headings -> H4. $wp_customize->add_setting( 'typography_h4_sizes', array( 'default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'tripp_customize_sanitize_sizes', ) ); $wp_customize->add_control( new Tripp_Customize_Unit_Control( $wp_customize, 'typography_h4_sizes', array( 'section' => 'typography_headings_section', 'label' => esc_html__( 'H4', 'tripp' ), 'placeholder' => esc_html__( 'Default', 'tripp' ), ) ) ); // Typography -> Headings -> H5. $wp_customize->add_setting( 'typography_h5_sizes', array( 'default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'tripp_customize_sanitize_sizes', ) ); $wp_customize->add_control( new Tripp_Customize_Unit_Control( $wp_customize, 'typography_h5_sizes', array( 'section' => 'typography_headings_section', 'label' => esc_html__( 'H5', 'tripp' ), 'placeholder' => esc_html__( 'Default', 'tripp' ), ) ) ); // Typography -> Headings -> H6. $wp_customize->add_setting( 'typography_h6_sizes', array( 'default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'tripp_customize_sanitize_sizes', ) ); $wp_customize->add_control( new Tripp_Customize_Unit_Control( $wp_customize, 'typography_h6_sizes', array( 'section' => 'typography_headings_section', 'label' => esc_html__( 'H6', 'tripp' ), 'placeholder' => esc_html__( 'Default', 'tripp' ), ) ) ); /** * Additional Font Settings. */ $font_settings = tripp_font_settings(); if ( ! empty( $font_settings ) ) { foreach ( $font_settings as $name => $settings ) { /** * Typography -> $settings['title']. */ $wp_customize->add_section( "typography_{$name}_section", array( 'panel' => 'typography_panel', 'title' => $settings['title'], ) ); if ( ! empty( $settings['family'] ) ) { // Typography -> $settings['title'] -> Font Family. $wp_customize->add_setting( "typography_{$name}_family", array( 'default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'tripp_customize_sanitize_dropdown', ) ); $wp_customize->add_control( new Tripp_Customize_Dropdown_Control( $wp_customize, "typography_{$name}_family", array( 'section' => "typography_{$name}_section", 'label' => esc_html__( 'Font Family', 'tripp' ), 'groups' => $font_options, ) ) ); } if ( ! empty( $settings['sizes'] ) ) { // Typography -> $settings['title'] -> Font Size. $wp_customize->add_setting( "typography_{$name}_sizes", array( 'default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'tripp_customize_sanitize_sizes', ) ); $wp_customize->add_control( new Tripp_Customize_Unit_Control( $wp_customize, "typography_{$name}_sizes", array( 'section' => "typography_{$name}_section", 'label' => esc_html__( 'Font Size', 'tripp' ), 'description' => esc_html__( 'If no unit is specified, px will be used by default.', 'tripp' ), 'placeholder' => esc_html__( 'Default', 'tripp' ), ) ) ); } } } } add_action( 'customize_register', 'tripp_customizer_register_typography_settings', 20 );