Load WooCommerce Star fonts via inline styles.

This commit is contained in:
Tiago Noronha 2017-08-28 22:15:22 +01:00
parent db7f3ed04f
commit 24b0596c71
2 changed files with 14 additions and 20 deletions

View File

@ -30,6 +30,20 @@ add_action( 'after_setup_theme', '_s_woocommerce_setup' );
*/ */
function _s_woocommerce_scripts() { function _s_woocommerce_scripts() {
wp_enqueue_style( '_s-woocommerce-style', get_template_directory_uri() . '/woocommerce.css' ); wp_enqueue_style( '_s-woocommerce-style', get_template_directory_uri() . '/woocommerce.css' );
$font_path = WC()->plugin_url() . '/assets/fonts/';
$inline_font = '@font-face {
font-family: "star";
src: url("' . $font_path . 'star.eot");
src: url("' . $font_path . 'star.eot?#iefix") format("embedded-opentype"),
url("' . $font_path . 'star.woff") format("woff"),
url("' . $font_path . 'star.ttf") format("truetype"),
url("' . $font_path . 'star.svg#star") format("svg");
font-weight: normal;
font-style: normal;
}';
wp_add_inline_style( '_s-woocommerce-style', $inline_font );
} }
add_action( 'wp_enqueue_scripts', '_s_woocommerce_scripts' ); add_action( 'wp_enqueue_scripts', '_s_woocommerce_scripts' );

View File

@ -4,12 +4,6 @@ Theme Name: _s
WooCommerce styles override WooCommerce styles override
*/ */
/**
* WooCommerce Plugin path variables
*/
$woocommerce__plugin-path: '../../plugins/woocommerce/';
$woocommerce__plugin-assets-font-path: '#{$woocommerce__plugin-path}assets/fonts/';
/** /**
* WooCommerce color variables * WooCommerce color variables
*/ */
@ -23,20 +17,6 @@ $woocommerce__color-info: #3D9CD2;
@import "variables-site/variables-site"; @import "variables-site/variables-site";
@import "mixins/mixins-master"; @import "mixins/mixins-master";
/**
* Fonts
*/
@font-face {
font-family: 'star';
src: url('#{$woocommerce__plugin-assets-font-path}star.eot');
src: url('#{$woocommerce__plugin-assets-font-path}star.eot?#iefix') format('embedded-opentype'),
url('#{$woocommerce__plugin-assets-font-path}star.woff') format('woff'),
url('#{$woocommerce__plugin-assets-font-path}star.ttf') format('truetype'),
url('#{$woocommerce__plugin-assets-font-path}star.svg#star') format('svg');
font-weight: normal;
font-style: normal;
}
/** /**
* Shop tables * Shop tables
*/ */