^ 回到顶部
  • 人生没有定律,每个人都有自己的节奏
  • 本站wordpress建站教程均通过实践后发布,希望对你有帮助
  • 希望你的坚持,都是因为热爱,而不是因为不甘心
  • 8年wordpress建站经验,5星服务品质
  • 那些不愿意让你吃亏的人,才是真正值得你深交的人,也是值得你付出时间的人
  • 阿里云2核2g仅需86元/年

wordpress函数get_editor_stylesheets()用法示例

get_editor_stylesheets()

Retrieve any registered editor stylesheets


描述


返回值

(array) If registered, a list of editor stylesheet URLs.

新用户2核2g仅需86元/年    领取1153套模板    免费cdn流量包    ¥3188礼包


源代码

File: wp-includes/theme.php

function get_editor_stylesheets() {
	$stylesheets = array();
	// load editor_style.css if the current theme supports it
	if ( ! empty( $GLOBALS['editor_styles'] ) && is_array( $GLOBALS['editor_styles'] ) ) {
		$editor_styles = $GLOBALS['editor_styles'];

		$editor_styles = array_unique( array_filter( $editor_styles ) );
		$style_uri = get_stylesheet_directory_uri();
		$style_dir = get_stylesheet_directory();

		// Support externally referenced styles (like, say, fonts).
		foreach ( $editor_styles as $key => $file ) {
			if ( preg_match( '~^(https?:)?//~', $file ) ) {
				$stylesheets[] = esc_url_raw( $file );
				unset( $editor_styles[ $key ] );
			}
		}

		// Look in a parent theme first, that way child theme CSS overrides.
		if ( is_child_theme() ) {
			$template_uri = get_template_directory_uri();
			$template_dir = get_template_directory();

			foreach ( $editor_styles as $key => $file ) {
				if ( $file && file_exists( "$template_dir/$file" ) ) {
					$stylesheets[] = "$template_uri/$file";
				}
			}
		}

		foreach ( $editor_styles as $file ) {
			if ( $file && file_exists( "$style_dir/$file" ) ) {
				$stylesheets[] = "$style_uri/$file";
			}
		}
	}

	/**
	 * Filters the array of stylesheets applied to the editor.
	 *
	 * @since 4.3.0
	 *
	 * @param array $stylesheets Array of stylesheets to be applied to the editor.
	 */
	return apply_filters( 'editor_stylesheets', $stylesheets );
}

更新日志

Version 描述
4.0.0 Introduced.

相关函数

Uses

  • wp-includes/theme.php:
    editor_stylesheets
  • wp-includes/theme.php:
    get_stylesheet_directory_uri()
  • wp-includes/theme.php:
    get_stylesheet_directory()
  • wp-includes/theme.php:
    get_template_directory_uri()
  • wp-includes/theme.php:
    get_template_directory()
  • wp-includes/theme.php:
    is_child_theme()
  • wp-includes/formatting.php:
    esc_url_raw()
  • wp-includes/plugin.php:
    apply_filters()
  • Show 3 more uses


Used By

  • wp-includes/class-wp-editor.php:
    _WP_Editors::editor_settings()

让小雨知道,这篇文章帮到了你
扫码关注微信公众号zs40086(微搜片)随时随地微信看片,抢先福利电影等你来

热门推荐

如有疑问,请前往问答中心反馈!

反馈