wordpress主题制作:引入外部CSS样式文件和JS脚本文件(3)-添加元数据到样式表(未完待续)

添加元数据到样式表:wp_style_add_data()
wp_style_add_data() 是一个非常棒的函数,它可以让你添加元数据到你的样式中,包括条件注释、RTL的支持和更多!

来看看吧:

function twentynineteen_scripts() { 
    wp_style_add_data( 'twentynineteen-style', 'rtl', 'replace' );
}
add_action( 'wp_enqueue_scripts', 'twentynineteen_scripts' );

twentynineteen-style:Name of the stylesheet.

rtl:Name of data point for which we're storing a value. Accepts 'conditional', 'rtl' and 'suffix', 'alt' and 'title'.

replace:String containing the CSS data to be added.

猜你喜欢

转载自www.cnblogs.com/zhaoweidong/p/10295518.html