Changeset 55266
- Timestamp:
- 02/07/2023 03:29:30 PM (21 months ago)
- Location:
- trunk/src/wp-content/themes/twentyseventeen
- Files:
-
- 36 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyseventeen/functions.php
r54902 r55266 122 122 /* 123 123 * This theme styles the visual editor to resemble the theme style, 124 * specifically font, colors, and column width. 125 */ 126 add_editor_style( array( 'assets/css/editor-style.css', twentyseventeen_fonts_url() ) ); 124 * specifically font, colors, and column width. When fonts are 125 * self-hosted, the theme directory needs to be removed first. 126 */ 127 $font_stylesheet = str_replace( 128 array( get_template_directory_uri() . '/', get_stylesheet_directory_uri() . '/' ), 129 '', 130 twentyseventeen_fonts_url() 131 ); 132 add_editor_style( array( 'assets/css/editor-style.css', $font_stylesheet ) ); 127 133 128 134 // Load regular editor styles into the new block-based editor. … … 284 290 add_action( 'template_redirect', 'twentyseventeen_content_width', 0 ); 285 291 286 /** 287 * Register custom fonts. 288 */ 289 function twentyseventeen_fonts_url() { 290 $fonts_url = ''; 291 292 /* 293 * translators: If there are characters in your language that are not supported 294 * by Libre Franklin, translate this to 'off'. Do not translate into your own language. 295 */ 296 $libre_franklin = _x( 'on', 'Libre Franklin font: on or off', 'twentyseventeen' ); 297 298 if ( 'off' !== $libre_franklin ) { 299 $font_families = array(); 300 301 $font_families[] = 'Libre Franklin:300,300i,400,400i,600,600i,800,800i'; 302 303 $query_args = array( 304 'family' => urlencode( implode( '|', $font_families ) ), 305 'subset' => urlencode( 'latin,latin-ext' ), 306 'display' => urlencode( 'fallback' ), 307 ); 308 309 $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); 310 } 311 312 return esc_url_raw( $fonts_url ); 313 } 292 if ( ! function_exists( 'twentyseventeen_fonts_url' ) ) : 293 /** 294 * Register custom fonts. 295 * 296 * @since Twenty Seventeen 1.0 297 * @since Twenty Seventeen 3.2 Replaced Google URL with self-hosted fonts. 298 * 299 * @return string Fonts URL for the theme. 300 */ 301 function twentyseventeen_fonts_url() { 302 $fonts_url = ''; 303 304 /* 305 * translators: If there are characters in your language that are not supported 306 * by Libre Franklin, translate this to 'off'. Do not translate into your own language. 307 */ 308 $libre_franklin = _x( 'on', 'Libre Franklin font: on or off', 'twentyseventeen' ); 309 310 if ( 'off' !== $libre_franklin ) { 311 $fonts_url = get_template_directory_uri() . '/assets/fonts/font-libre-franklin.css'; 312 } 313 314 return esc_url_raw( $fonts_url ); 315 } 316 endif; 314 317 315 318 /** … … 317 320 * 318 321 * @since Twenty Seventeen 1.0 322 * @deprecated Twenty Seventeen 3.2 Disabled filter because, by default, fonts are self-hosted. 319 323 * 320 324 * @param array $urls URLs to print for resource hints. … … 332 336 return $urls; 333 337 } 334 add_filter( 'wp_resource_hints', 'twentyseventeen_resource_hints', 10, 2 );338 // add_filter( 'wp_resource_hints', 'twentyseventeen_resource_hints', 10, 2 ); 335 339 336 340 /** … … 452 456 function twentyseventeen_scripts() { 453 457 // Add custom fonts, used in the main stylesheet. 454 wp_enqueue_style( 'twentyseventeen-fonts', twentyseventeen_fonts_url(), array(), null ); 458 $font_version = ( 0 === strpos( (string) twentyseventeen_fonts_url(), get_template_directory_uri() . '/' ) ) ? '20230328' : null; 459 wp_enqueue_style( 'twentyseventeen-fonts', twentyseventeen_fonts_url(), array(), $font_version ); 455 460 456 461 // Theme stylesheet. … … 518 523 wp_enqueue_style( 'twentyseventeen-block-editor-style', get_theme_file_uri( '/assets/css/editor-blocks.css' ), array(), '20220912' ); 519 524 // Add custom fonts. 520 wp_enqueue_style( 'twentyseventeen-fonts', twentyseventeen_fonts_url(), array(), null ); 525 $font_version = ( 0 === strpos( (string) twentyseventeen_fonts_url(), get_template_directory_uri() . '/' ) ) ? '20230328' : null; 526 wp_enqueue_style( 'twentyseventeen-fonts', twentyseventeen_fonts_url(), array(), $font_version ); 521 527 } 522 528 add_action( 'enqueue_block_editor_assets', 'twentyseventeen_block_editor_styles' ); -
trunk/src/wp-content/themes/twentyseventeen/readme.txt
r55024 r55266 53 53 License: SIL Open Font License, version 1.1. 54 54 Source: http://fontawesome.io/ 55 56 Libre Franklin Font 57 Copyright 2020 The LibreFranklin Project Authors (https://github.com/impallari/Libre-Franklin) 58 License: SIL Open Font License, 1.1, https://opensource.org/licenses/OFL-1.1 59 Source: https://fontsource.org/fonts/libre-franklin 55 60 56 61 Bundled header image, Copyright Alvin Engler
Note: See TracChangeset
for help on using the changeset viewer.