2014-04-25 73 views
0

作爲Google Fonts Manager plugin的作者,我也有這個問題。自定義字體下拉菜單不再顯示,TinyMCE文檔根本沒有任何幫助。該插件使用以下函數:theme_advanced_buttons1_add_before,theme_advanced_fonts和tiny_mce_before_init添加字體選項。它不再起作用,而且我很困惑(至今)如何解決這個問題。有任何想法嗎??WordPress 3.9和TinyMCE 4.0自定義按鈕插件修復

下面是當前的代碼:

//add font selection to TinyMCE 
function wp_googlefontmgr_formatTinyMCE($init) { 

//get option settings 
$myfontlist = ""; 
$mycsslist = ""; 
$editorfonts = get_option("wp_googlefontmgr_editorfonts", 1); 
$websafefonts = get_option("wp_googlefontmgr_safefonts", 1); 

if($editorfonts) { 
    if($websafefonts) { 
     //get websafefont list 
     $safefontlist = 'Arial=Arial,Helvetica,sans-serif,Arial Black=Arial Black,Gadget,sans-serif,Comic Sans=Comic Sans MS,Comic Sans MS,cursive,Courier New=Courier New,Courier New,Courier,monospace,Georgia=Georgia,Georgia,serif,'; 
     $safefontlist .= 'Impact=Impact,Charcoal,sans-serif,Lucida Console=Lucida Console,Monaco,monospace,Lucida Sans Unicode=Lucida Sans Unicode,Lucida Grande,sans-serif,Palatino Linotype=Palatino Linotype,Book Antiqua,Palatino,serif,'; 
     $safefontlist .= 'Tahoma=Tahoma,Geneva,sans-serif,Times New Roman=Times New Roman,Times,serif,Trebuchet MS=Trebuchet MS,Helvetica,sans-serif,Verdana=Verdana,Geneva,sans-serif,Gill Sans=Gill Sans,Geneva,sans-serif,'; 
    } 
    $fontdata = get_option("wp_googlefontmgr_fonts"); 
    //get the google font list 
    if($fontdata) { 
     //load fonts for use in plugin 
     $array = explode(",", $fontdata); 
     foreach($array as $value) { 
      $myfontlist .=sprintf(_('%s=%s,'), $value, $value); 
      $mycsslist .= "http://fonts.googleapis.com/css?family=" .urlencode($value). ","; 
     } 
    } 
    //check if websafe fonts are to be loaded 
    if($websafefonts){ 
     $myfontlist = $myfontlist. $safefontlist; 
    } 
    $init['content_css']=get_template_directory_uri() . "/editor-style.css"; 
    $init['content_css']=rtrim($mycsslist,','); 
    $init['theme_advanced_buttons1_add_before'] = 'formatselect,fontselect'; 
    $init['theme_advanced_fonts'] = rtrim($myfontlist,','); 

    return $init; 
} 
} 

回答

1

更換theme_advanced_fontsfont_formats