wp_get_custom_css

函数


wp_get_custom_css ( $stylesheet = '' )
参数
  • (string)
    $stylesheet
    Optional. A theme object stylesheet name. Defaults to the active theme.
    Required:
    Default: (empty)
返回值
  • (string) The Custom CSS Post content.
定义位置
  • wp-includes/theme.php
    , line 1954
引入
4.7.0
弃用

获取保存的自定义CSS内容进行渲染。

function wp_get_custom_css( $stylesheet = '' ) {
	$css = '';

	if ( empty( $stylesheet ) ) {
		$stylesheet = get_stylesheet();
	}

	$post = wp_get_custom_css_post( $stylesheet );
	if ( $post ) {
		$css = $post->post_content;
	}

	/**
	 * Filters the custom CSS output into the head element.
	 *
	 * @since 4.7.0
	 *
	 * @param string $css        CSS pulled in from the Custom CSS post type.
	 * @param string $stylesheet The theme stylesheet name.
	 */
	$css = apply_filters( 'wp_get_custom_css', $css, $stylesheet );

	return $css;
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。