add_editor_style()

热度:75
Function:为自定义TinyMCE编辑器样式表添加回调。
版本 20190723
所属分类 Functions
可使用页面 All
默认值

add_editor_style( array|string $stylesheet = 'editor-style.css' )

  • 为自定义TinyMCE编辑器样式表添加回调。


描述:

参数$ stylesheet是相对于主题根的样式表的名称。它还接受一系列样式表。它是可选的,默认为'editor-style.css'。

此函数自动添加另一个带有-rtl前缀的样式表,例如editor-style-rtl.css。如果该文件不存在,则在将样式表添加到TinyMCE之前将其删除。如果将样式表数组传递给add_editor_style(),则仅为第一个样式表添加RTL。


参数:

$stylesheet

(array|string) (Optional) 相对于主题根的样式表名称或其数组。默认为'editor-style.css'

Default value(默认值): 'editor-style.css'


示例:

function add_editor_style( $stylesheet = 'editor-style.css' ) {

    add_theme_support( 'editor-style' );

 

    if ( ! is_admin() ) {

        return;

    }

 

    global $editor_styles;

    $editor_styles = (array) $editor_styles;

    $stylesheet    = (array) $stylesheet;

    if ( is_rtl() ) {

问题反馈反馈和建议QQ群:785318993