2013-07-31 61 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

相關問題