2013-07-31 56 views
0

如何使用add_editor_style()包含外部css如谷歌字体http://fonts.googleapis.com/css?family=Lato如何使用add_editor_style()在wordpress中包含绝对的css路径

当我添加add_editor_style('http://fonts.googleapis.com/css?family=Lato');,在源代码中会显示这样的:

<link rel="stylesheet" data-mce-href="http://203.223.152.159/~marineac/wp-content/themes/twentyten/http://fonts.googleapis.com/css?family=Lato&amp;ver=342-201106301" href="http://203.223.152.159/~marineac/wp-content/themes/twentyten/http://fonts.googleapis.com/css?family=Lato&amp;ver=342-201106301"> 

回答

1

您应该使用mce_css过滤器。未测试:

function so_17961871($mce_css) { 
    if (! empty($mce_css)) 
     $mce_css .= ','; 
    $mce_css .= 'http://fonts.googleapis.com/css?family=Lato'; 

    return $mce_css; 
} 

add_filter('mce_css', 'so_17961871'); 
+0

可以请你看看http://wordpress.stackexchange.com/questions/214858/how-to-hide-product-attribute-from-quick-edit-panel-woocommerce – 2016-01-18 12:32:51

1

这在changeset 24735我相信这是3.6或3.6.1部分修补。

+0

是的。请注意,如果您想使用多个字体(例如,'$ font_url ='http://fonts.googleapis.com/css?family = Lato:300,400,700''),则需要对逗号进行网址编码:执行'str_replace (',','%2C',$ font_url)'在传递给'add_editor_style'之前。 –

+0

嗨,你可以看看这个问题http://wordpress.stackexchange.com/questions/214858/how-to-hide-product-attribute-from-quick-edit-panel-woocommerce – 2016-01-18 12:32:11

相关问题