فهرست منبع

Fallback to the old function name in case users are still on the old version of Gutenberg (#5250)

Ben Dwyer 3 سال پیش
والد
کامیت
18c6bcb1f8
2فایلهای تغییر یافته به همراه12 افزوده شده و 2 حذف شده
  1. 6 1
      blockbase/inc/customizer/wp-customize-colors.php
  2. 6 1
      blockbase/inc/customizer/wp-customize-fonts.php

+ 6 - 1
blockbase/inc/customizer/wp-customize-colors.php

@@ -162,7 +162,12 @@ class GlobalStylesColorCustomizer {
 		$this->update_user_color_palette( $wp_customize );
 		$this->update_user_color_palette( $wp_customize );
 
 
 		// 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_global_styles_post_id();
+		if ( method_exists( WP_Theme_JSON_Resolver_Gutenberg, 'get_user_global_styles_post_id' ) ) { // This is the new name.
+			$user_custom_post_type_id = WP_Theme_JSON_Resolver_Gutenberg::get_user_global_styles_post_id();
+		} else if ( method_exists( WP_Theme_JSON_Resolver_Gutenberg, 'get_user_custom_post_type_id' ) ) { // This is the old name.
+			$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 );
 		$user_theme_json_post_content = json_decode( $user_theme_json_post->post_content );
 		$user_theme_json_post_content = json_decode( $user_theme_json_post->post_content );
 
 

+ 6 - 1
blockbase/inc/customizer/wp-customize-fonts.php

@@ -505,7 +505,12 @@ class GlobalStylesFontsCustomizer {
 		$heading_font_family_variable = 'var(--wp--preset--font-family--' . $heading_setting['slug'] . ')';
 		$heading_font_family_variable = 'var(--wp--preset--font-family--' . $heading_setting['slug'] . ')';
 
 
 		// 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_global_styles_post_id();
+		if ( method_exists( WP_Theme_JSON_Resolver_Gutenberg, 'get_user_global_styles_post_id' ) ) { // This is the new name.
+			$user_custom_post_type_id = WP_Theme_JSON_Resolver_Gutenberg::get_user_global_styles_post_id();
+		} else if ( method_exists( WP_Theme_JSON_Resolver_Gutenberg, 'get_user_custom_post_type_id' ) ) { // This is the old name.
+			$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 );
 		$user_theme_json_post_content = json_decode( $user_theme_json_post->post_content );
 		$user_theme_json_post_content = json_decode( $user_theme_json_post->post_content );