文章编辑器添加一个自定义的CSS样式表
用法
<?php add_editor_style( $stylesheet ); ?>
参数:
$stylesheet (string/array) (可选) Path to a stylesheet file, relative to the current theme directory, or an array thereof to link multiple stylesheet files. 默认值: "editor-style.css" If a child theme is used, both the current child and parent theme directories are considered (see Description). As of version 3.6, http or https URLs (e.g.,http://example/style.css
) can be used. Root-relative URLs will not work: e.g.,/editor-style.css
is treated the same aseditor-style.css
. Paths with a query string (e.g.,editor-style?ver=…
) will fail to be added. You can work around that by using the equivalent http(s) URL, e.g. ,http://example/editor-style.css?ver=…
. (get_stylesheet_directory_uri() and home_url() can help you build "full" URLs.) Call get_editor_stylesheets() to see which styles have been added.
举例:
/**
* Registers an editor stylesheet for the theme.
*/
function wp_bootstrap_4_add_editor_styles() {
add_editor_style( 'editor-style.css' );
}
add_action( 'admin_init', 'wp_bootstrap_4_add_editor_styles' );
参考: