diff --git a/functions.php b/functions.php index 69528f90..42918057 100644 --- a/functions.php +++ b/functions.php @@ -20,10 +20,30 @@ function twentytwentytwo_support() { * Enqueue scripts and styles. */ function twentytwentytwo_styles() { + // The @font-face styles. + $font_face_css = " + @font-face{ + font-family: 'Source Serif Pro'; + font-weight: 200 900; + font-style: normal; + font-stretch: normal; + src: url('" . get_theme_file_uri( 'assets/fonts/source-serif-pro/SourceSerif4Variable-Roman.ttf.woff2' ) . "') format('woff2'); + } + + @font-face{ + font-family: 'Source Serif Pro'; + font-weight: 200 900; + font-style: italic; + font-stretch: normal; + src: url('" . get_theme_file_uri( 'assets/fonts/source-serif-pro/SourceSerif4Variable-Italic.ttf.woff2' ) . "') format('woff2'); + } + "; + // Register theme stylesheet. + wp_register_style( 'twentytwentytwo-style', '' ); + // Add styles inline. + wp_add_inline_style( 'twentytwentytwo-style', $font_face_css ); // Enqueue theme stylesheet. - $theme_version = wp_get_theme()->get( 'Version' ); - $version_string = is_string( $theme_version ) ? $theme_version : false; - wp_enqueue_style( 'twentytwentytwo-style', get_template_directory_uri() . '/style.css', array(), $version_string ); + wp_enqueue_style( 'twentytwentytwo-style' ); } add_action( 'wp_enqueue_scripts', 'twentytwentytwo_styles' ); endif; @@ -41,4 +61,4 @@ function twentytwentytwo_editor_styles() { ); } add_action( 'admin_init', 'twentytwentytwo_editor_styles' ); -endif; \ No newline at end of file +endif; diff --git a/style.css b/style.css index e387e913..325321d7 100644 --- a/style.css +++ b/style.css @@ -14,36 +14,3 @@ Text Domain: twentytwentytwo Twenty Twenty-Two WordPress Theme, (C) 2021 WordPress.org Twenty Twenty-Two is distributed under the terms of the GNU GPL. */ - -/*-------------------------------------------------------------- - >>> TABLE OF CONTENTS: - ---------------------------------------------------------------- - - 0. Fonts - - ----------------------------------------------------------------------------- */ - -/* -------------------------------------------------------------------------- */ -/* 0. Fonts -/* -------------------------------------------------------------------------- */ - -/* - * Fonts can be reworked if this core issue is resolved: - * https://github.com/WordPress/wordpress-develop/pull/1573 - */ - -@font-face{ - font-family: 'Source Serif Pro'; - font-weight: 200 900; - font-style: normal; - font-stretch: normal; - src: url('/wp-content/themes/twentytwentytwo/assets/fonts/source-serif-pro/SourceSerif4Variable-Roman.ttf.woff2') format('woff2'); -} - -@font-face{ - font-family: 'Source Serif Pro'; - font-weight: 200 900; - font-style: italic; - font-stretch: normal; - src: url('/wp-content/themes/twentytwentytwo/assets/fonts/source-serif-pro/SourceSerif4Variable-Italic.ttf.woff2') format('woff2'); -}