Typography %s sample not working
-
The output sample at https://aristath.github.io/kirki/docs/controls/typography.html returns %s instead of the values. What am I doing wrong?
My setting code:
Kirki::add_field( 'theme_config_id', array( 'type' => 'typography', 'settings' => 'my_setting', 'label' => esc_attr__( 'Control Label', 'textdomain' ), 'section' => 'fonts', 'default' => array( 'font-family' => 'Roboto', 'variant' => 'regular', 'font-size' => '14px', 'line-height' => '1.5', 'letter-spacing' => '0', 'subsets' => array( 'latin-ext' ), 'color' => '#333333', 'text-transform' => 'none', 'text-align' => 'left' ), 'priority' => $priority++, 'output' => array( array( 'element' => 'body', ), ), ) );
and the code in my theme
<?php $value = get_theme_mod( 'my_setting', array() ); if ( isset( $value['font-family'] ) ) { echo '<p>' . sprintf( esc_attr_e( 'Font Family: %s', 'textdomain' ), $value['font-family'] ) . '</p>'; } if ( isset( $value['variant'] ) ) { echo '<p>' . sprintf( esc_attr_e( 'Variant: %s', 'textdomain' ), $value['variant'] ) . '</p>'; } if ( isset( $value['subsets'] ) ) { if ( is_array( $value['subsets'] ) ) { echo '<p>' . sprintf( esc_attr_e( 'Subsets: %s', 'textdomain' ), implode( ', ', $value['subsets'] ) ) . '</p>'; } else { echo '<p>' . sprintf( esc_attr_e( 'Subset: %s', 'textdomain' ), $value['subsets'] ) . '</p>'; } } if ( isset( $value['font-size'] ) ) { echo '<p>' . sprintf( esc_attr_e( 'Font Size: %s', 'textdomain' ), $value['font-size'] ) . '</p>'; } if ( isset( $value['line-height'] ) ) { echo '<p>' . sprintf( esc_attr_e( 'Line Height: %s', 'textdomain' ), $value['line-height'] ) . '</p>'; } if ( isset( $value['letter-spacing'] ) ) { echo '<p>' . sprintf( esc_attr_e( 'Letter Spacing: %s', 'textdomain' ), $value['letter-spacing'] ) . '</p>'; } if ( isset( $value['color'] ) ) { echo '<p>' . sprintf( esc_attr_e( 'Color: %s', 'textdomain' ), $value['color'] ) . '</p>'; }
WP 4.9.1 / PHP7 / Apache
The page I need help with: [log in to see the link]
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Typography %s sample not working’ is closed to new replies.