Make WordPress Core

Ticket #45880: 45880.diff

File 45880.diff, 1.8 KB (added by noisysocks, 4 years ago)
  • src/wp-content/themes/twentyseventeen/functions.php

     
    117117         * This theme styles the visual editor to resemble the theme style,
    118118         * specifically font, colors, and column width.
    119119          */
    120         add_editor_style( array( 'assets/css/editor-style.css', twentyseventeen_fonts_url() ) );
     120        $editor_style = array( 'assets/css/editor-style.css' );
     121        $fonts_url    = twentyseventeen_fonts_url();
     122        if ( $fonts_url ) {
     123                $editor_style[] = $fonts_url;
     124        }
     125        add_editor_style( $editor_style );
    121126
    122127        // Load regular editor styles into the new block-based editor.
    123128        add_theme_support( 'editor-styles' );
     
    445450 */
    446451function twentyseventeen_scripts() {
    447452        // Add custom fonts, used in the main stylesheet.
    448         wp_enqueue_style( 'twentyseventeen-fonts', twentyseventeen_fonts_url(), array(), null );
     453        $fonts_url = twentyseventeen_fonts_url();
     454        if ( $fonts_url ) {
     455                wp_enqueue_style( 'twentyseventeen-fonts', $fonts_url, array(), null );
     456        }
    449457
    450458        // Theme stylesheet.
    451459        wp_enqueue_style( 'twentyseventeen-style', get_stylesheet_uri(), array(), '20190507' );
     
    511519        // Block styles.
    512520        wp_enqueue_style( 'twentyseventeen-block-editor-style', get_theme_file_uri( '/assets/css/editor-blocks.css' ), array(), '20190328' );
    513521        // Add custom fonts.
    514         wp_enqueue_style( 'twentyseventeen-fonts', twentyseventeen_fonts_url(), array(), null );
     522        $fonts_url = twentyseventeen_fonts_url();
     523        if ( $fonts_url ) {
     524                wp_enqueue_style( 'twentyseventeen-fonts', $fonts_url, array(), null );
     525        }
    515526}
    516527add_action( 'enqueue_block_editor_assets', 'twentyseventeen_block_editor_styles' );
    517528