|
@@ -150,7 +150,7 @@ class GlobalStylesFontsCustomizer {
|
|
'name' => 'Raleway',
|
|
'name' => 'Raleway',
|
|
'google' => 'family=Raleway:ital,wght@0,100..900;1,100..900',
|
|
'google' => 'family=Raleway:ital,wght@0,100..900;1,100..900',
|
|
),
|
|
),
|
|
- 'red-hat-display'=> array(
|
|
|
|
|
|
+ 'red-hat-display' => array(
|
|
'fontFamily' => '"Red Hat Display", sans-serif',
|
|
'fontFamily' => '"Red Hat Display", sans-serif',
|
|
'slug' => 'red-hat-display',
|
|
'slug' => 'red-hat-display',
|
|
'name' => 'Red Hat Display',
|
|
'name' => 'Red Hat Display',
|
|
@@ -379,8 +379,8 @@ class GlobalStylesFontsCustomizer {
|
|
}
|
|
}
|
|
|
|
|
|
function handle_customize_save_after( $wp_customize ) {
|
|
function handle_customize_save_after( $wp_customize ) {
|
|
- $body_value = $wp_customize->get_setting( $this->section_key . 'body' )->post_value();
|
|
|
|
- $heading_value = $wp_customize->get_setting( $this->section_key . 'heading' )->post_value();
|
|
|
|
|
|
+ $body_value = $wp_customize->get_setting( $this->section_key . 'body' )->value();
|
|
|
|
+ $heading_value = $wp_customize->get_setting( $this->section_key . 'heading' )->value();
|
|
|
|
|
|
if ( ! isset( $body_value ) && ! isset( $heading_value ) ) {
|
|
if ( ! isset( $body_value ) && ! isset( $heading_value ) ) {
|
|
return;
|
|
return;
|
|
@@ -409,14 +409,6 @@ class GlobalStylesFontsCustomizer {
|
|
$body_font_family_variable = 'var(--wp--preset--font-family--' . $body_setting['slug'] . ')';
|
|
$body_font_family_variable = 'var(--wp--preset--font-family--' . $body_setting['slug'] . ')';
|
|
$heading_font_family_variable = 'var(--wp--preset--font-family--' . $heading_setting['slug'] . ')';
|
|
$heading_font_family_variable = 'var(--wp--preset--font-family--' . $heading_setting['slug'] . ')';
|
|
|
|
|
|
- $google_font_array = array();
|
|
|
|
- if ( isset( $body_setting['google'] ) ) {
|
|
|
|
- $google_font_array[] = $body_setting['google'];
|
|
|
|
- }
|
|
|
|
- if ( isset( $heading_setting['google'] ) ) {
|
|
|
|
- $google_font_array[] = $heading_setting['google'];
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
// Get the user's theme.json from the CPT.
|
|
// Get the user's theme.json from the CPT.
|
|
$user_custom_post_type_id = WP_Theme_JSON_Resolver_Gutenberg::get_user_custom_post_type_id();
|
|
$user_custom_post_type_id = WP_Theme_JSON_Resolver_Gutenberg::get_user_custom_post_type_id();
|
|
$user_theme_json_post = get_post( $user_custom_post_type_id );
|
|
$user_theme_json_post = get_post( $user_custom_post_type_id );
|
|
@@ -497,15 +489,17 @@ class GlobalStylesFontsCustomizer {
|
|
|
|
|
|
//If the typeface choices === the default then we remove it instead
|
|
//If the typeface choices === the default then we remove it instead
|
|
if ( $body_value === $body_default && $heading_value === $heading_default ) {
|
|
if ( $body_value === $body_default && $heading_value === $heading_default ) {
|
|
- unset( $user_theme_json_post_content->styles->typography->fontFamilies );
|
|
|
|
- unset( $user_theme_json_post_content->styles->blocks->{'core/button'}->typography->fontFamilies );
|
|
|
|
- unset( $user_theme_json_post_content->styles->elemenets->h1->typography->fontFamilies );
|
|
|
|
- unset( $user_theme_json_post_content->styles->elemenets->h2->typography->fontFamilies );
|
|
|
|
- unset( $user_theme_json_post_content->styles->elemenets->h3->typography->fontFamilies );
|
|
|
|
- unset( $user_theme_json_post_content->styles->elemenets->h4->typography->fontFamilies );
|
|
|
|
- unset( $user_theme_json_post_content->styles->elemenets->h5->typography->fontFamilies );
|
|
|
|
- unset( $user_theme_json_post_content->styles->elemenets->h6->typography->fontFamilies );
|
|
|
|
- unset( $user_theme_json_post_content->styles->blocks->{'core/post-title'}->typography->fontFamilies );
|
|
|
|
|
|
+ unset( $user_theme_json_post_content->settings->typography->fontFamilies );
|
|
|
|
+ unset( $user_theme_json_post_content->styles->typography->fontFamily );
|
|
|
|
+ unset( $user_theme_json_post_content->styles->elements->h1->typography->fontFamily );
|
|
|
|
+ unset( $user_theme_json_post_content->styles->elements->h2->typography->fontFamily );
|
|
|
|
+ unset( $user_theme_json_post_content->styles->elements->h3->typography->fontFamily );
|
|
|
|
+ unset( $user_theme_json_post_content->styles->elements->h4->typography->fontFamily );
|
|
|
|
+ unset( $user_theme_json_post_content->styles->elements->h5->typography->fontFamily );
|
|
|
|
+ unset( $user_theme_json_post_content->styles->elements->h6->typography->fontFamily );
|
|
|
|
+ unset( $user_theme_json_post_content->styles->blocks->{'core/button'}->typography->fontFamily );
|
|
|
|
+ unset( $user_theme_json_post_content->styles->blocks->{'core/post-title'}->typography->fontFamily );
|
|
|
|
+ unset( $user_theme_json_post_content->styles->blocks->{'core/pullquote'}->typography->fontFamily );
|
|
}
|
|
}
|
|
|
|
|
|
// Update the theme.json with the new settings.
|
|
// Update the theme.json with the new settings.
|