Changeset 55268
- Timestamp:
- 02/07/2023 03:50:14 PM (20 months ago)
- Location:
- trunk/src/wp-content/themes/twentyfifteen
- Files:
-
- 90 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyfifteen/functions.php
r54492 r55268 171 171 /* 172 172 * This theme styles the visual editor to resemble the theme style, 173 * specifically font, colors, icons, and column width. 174 */ 175 add_editor_style( array( 'css/editor-style.css', 'genericons/genericons.css', twentyfifteen_fonts_url() ) ); 173 * specifically font, colors, icons, and column width. When fonts are 174 * self-hosted, the theme directory needs to be removed first. 175 */ 176 $font_stylesheet = str_replace( 177 array( get_template_directory_uri() . '/', get_stylesheet_directory_uri() . '/' ), 178 '', 179 twentyfifteen_fonts_url() 180 ); 181 add_editor_style( array( 'css/editor-style.css', 'genericons/genericons.css', $font_stylesheet ) ); 176 182 177 183 // Load regular editor styles into the new block-based editor. … … 348 354 if ( ! function_exists( 'twentyfifteen_fonts_url' ) ) : 349 355 /** 350 * Register Googlefonts for Twenty Fifteen.356 * Register fonts for Twenty Fifteen. 351 357 * 352 358 * @since Twenty Fifteen 1.0 359 * @since Twenty Fifteen 3.4 Replaced Google URL with self-hosted fonts. 353 360 * 354 * @return string Google fonts URL for the theme.361 * @return string Fonts URL for the theme. 355 362 */ 356 363 function twentyfifteen_fonts_url() { 357 364 $fonts_url = ''; 358 365 $fonts = array(); 359 $subsets = 'latin,latin-ext';360 366 361 367 /* … … 364 370 */ 365 371 if ( 'off' !== _x( 'on', 'Noto Sans font: on or off', 'twentyfifteen' ) ) { 366 $fonts[] = ' Noto Sans:400italic,700italic,400,700';372 $fonts[] = 'noto-sans'; 367 373 } 368 374 … … 372 378 */ 373 379 if ( 'off' !== _x( 'on', 'Noto Serif font: on or off', 'twentyfifteen' ) ) { 374 $fonts[] = ' Noto Serif:400italic,700italic,400,700';380 $fonts[] = 'noto-serif'; 375 381 } 376 382 … … 380 386 */ 381 387 if ( 'off' !== _x( 'on', 'Inconsolata font: on or off', 'twentyfifteen' ) ) { 382 $fonts[] = ' Inconsolata:400,700';388 $fonts[] = 'inconsolata'; 383 389 } 384 390 385 /*386 * translators: To add an additional character subset specific to your language,387 * translate this to 'greek', 'cyrillic', 'devanagari' or 'vietnamese'. Do not translate into your own language.388 */389 $subset = _x( 'no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'twentyfifteen' );390 391 if ( 'cyrillic' === $subset ) {392 $subsets .= ',cyrillic,cyrillic-ext';393 } elseif ( 'greek' === $subset ) {394 $subsets .= ',greek,greek-ext';395 } elseif ( 'devanagari' === $subset ) {396 $subsets .= ',devanagari';397 } elseif ( 'vietnamese' === $subset ) {398 $subsets .= ',vietnamese';399 }400 401 391 if ( $fonts ) { 402 $fonts_url = add_query_arg( 403 array( 404 'family' => urlencode( implode( '|', $fonts ) ), 405 'subset' => urlencode( $subsets ), 406 'display' => urlencode( 'fallback' ), 407 ), 408 'https://fonts.googleapis.com/css' 409 ); 392 $fonts_url = get_template_directory_uri() . '/assets/fonts/' . implode( '-plus-', $fonts ) . '.css'; 410 393 } 411 394 … … 433 416 function twentyfifteen_scripts() { 434 417 // Add custom fonts, used in the main stylesheet. 435 wp_enqueue_style( 'twentyfifteen-fonts', twentyfifteen_fonts_url(), array(), null ); 418 $font_version = ( 0 === strpos( (string) twentyfifteen_fonts_url(), get_template_directory_uri() . '/' ) ) ? '20230328' : null; 419 wp_enqueue_style( 'twentyfifteen-fonts', twentyfifteen_fonts_url(), array(), $font_version ); 436 420 437 421 // Add Genericons, used in the main stylesheet. … … 483 467 wp_enqueue_style( 'twentyfifteen-block-editor-style', get_template_directory_uri() . '/css/editor-blocks.css', array(), '20220908' ); 484 468 // Add custom fonts. 485 wp_enqueue_style( 'twentyfifteen-fonts', twentyfifteen_fonts_url(), array(), null ); 469 $font_version = ( 0 === strpos( (string) twentyfifteen_fonts_url(), get_template_directory_uri() . '/' ) ) ? '20230328' : null; 470 wp_enqueue_style( 'twentyfifteen-fonts', twentyfifteen_fonts_url(), array(), $font_version ); 486 471 } 487 472 add_action( 'enqueue_block_editor_assets', 'twentyfifteen_block_editor_styles' ); … … 492 477 * 493 478 * @since Twenty Fifteen 1.7 479 * @deprecated Twenty Fifteen 3.4 Disabled filter because, by default, fonts are self-hosted. 494 480 * 495 481 * @param array $urls URLs to print for resource hints. … … 511 497 return $urls; 512 498 } 513 add_filter( 'wp_resource_hints', 'twentyfifteen_resource_hints', 10, 2 );499 // add_filter( 'wp_resource_hints', 'twentyfifteen_resource_hints', 10, 2 ); 514 500 515 501 /** -
trunk/src/wp-content/themes/twentyfifteen/readme.txt
r55024 r55268 53 53 License: GNU GPL, Version 2 (or later) 54 54 Source: http://www.genericons.com 55 56 Noto Sans Font 57 Copyright 2015-2021 Google LLC. All Rights Reserved. 58 License: SIL Open Font License, 1.1, https://opensource.org/licenses/OFL-1.1 59 Source: https://fontsource.org/fonts/noto-sans 60 61 Noto Serif Font 62 Copyright 2012 Google Inc. All Rights Reserved. 63 License: SIL Open Font License, 1.1, https://opensource.org/licenses/OFL-1.1 64 Source: https://fontsource.org/fonts/noto-serif 65 66 Inconsolata Font 67 Copyright 2006 The Inconsolata Project Authors (https://github.com/cyrealtype/Inconsolata) 68 License: SIL Open Font License, 1.1, https://opensource.org/licenses/OFL-1.1 69 Source: https://fontsource.org/fonts/inconsolata 55 70 56 71 Block Pattern Images
Note: See TracChangeset
for help on using the changeset viewer.