id, array( 'widgets', 'nav-menus' ), true ) ) { return; } // Enqueue fonts. wp_enqueue_style( 'pressbook-dark-editor-fonts', PressBook_Dark_Scripts::fonts_url(), array(), null ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion // Add inline style for fonts in the block editor. $this->load_editor_fonts_css(); // Enqueue the block editor stylesheet. wp_enqueue_style( 'pressbook-dark-block-editor-style', get_theme_file_uri( 'inc/block-editor.css' ), array(), PRESSBOOK_DARK_VERSION ); wp_style_add_data( 'pressbook-dark-block-editor-style', 'rtl', 'replace' ); // Add output of customizer settings as inline style. wp_add_inline_style( 'pressbook-dark-block-editor-style', PressBook\CSSRules::output_editor() ); } /** * Add inline style for fonts in the block editor. */ public function load_editor_fonts_css() { $fonts_css = ''; /* translators: If there are characters in your language that are not supported by Open Sans, translate this to 'off'. Do not translate into your own language. */ $open_sans = _x( 'on', 'Open Sans font (in the editor): on or off', 'pressbook-dark' ); if ( 'off' !== $open_sans ) { $fonts_css .= ( '.block-editor-page .editor-styles-wrapper{font-family:\'Open Sans\', sans-serif;}' ); } /* translators: If there are characters in your language that are not supported by Playfair Display, translate this to 'off'. Do not translate into your own language. */ $playfair_display = _x( 'on', 'Playfair Display font (in the editor): on or off', 'pressbook-dark' ); if ( 'off' !== $playfair_display ) { $fonts_css .= ( '.editor-styles-wrapper .editor-post-title__input,.editor-styles-wrapper .editor-post-title .editor-post-title__input,.editor-styles-wrapper h1,.editor-styles-wrapper h2,.editor-styles-wrapper h3,.editor-styles-wrapper h4,.editor-styles-wrapper h5,.editor-styles-wrapper h6{font-family:\'Playfair Display\', sans-serif;}' ); } if ( '' !== $fonts_css ) { wp_add_inline_style( 'pressbook-dark-editor-fonts', $fonts_css ); } } }