Feature request: Define CSS variables
-
Hi Danny,
Would you consider outputing the font family names as CSS variables? Something like the following:
function test_inline_styles() { $body_font = ogf_build_font_stack( get_theme_mod( 'ogf_body_font' ) ); $heading_font = ogf_build_font_stack( get_theme_mod( 'ogf_heading_font' ) ); $css = ' :root { --font-body: ' . esc_attr( $body_font ) . '; --font-heading: ' . esc_attr( $heading_font ) . '; } '; wp_add_inline_style( 'child-style', wp_strip_all_tags( $css ) ); } add_action( 'wp_enqueue_scripts', 'test_inline_styles' );This way the theme can use these variables in custom places.
Thanks!
-Kathy
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
The topic ‘Feature request: Define CSS variables’ is closed to new replies.