簡単にTinymce AdvancedのFontにGoogle Fontを追加する方法

Pocket

使うプラグイン:

  • TK Google Fonts
  • TinyMCE Advanced
  1. TK Google Fontsを有効にし、フォントを追加
  2. functions.phpに
    function load_custom_fonts($init) {
        $font_formats = isset($init['font_formats']) ? $init['font_formats'] : 'Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats';
        $custom_fonts = ';'.'Istok Web=istok web;Cardo=cardo';
        $init['font_formats'] = $font_formats . $custom_fonts;
        return $init;
    }
    add_filter('tiny_mce_before_init', 'load_custom_fonts');
    

    のように、追加したfontを $custom_fontsに追記する

  3. フロントエンドとバックエンドの両方で使えていることを確認する

 

Comments on this post

No comments.

Leave a Reply

Your email address will not be published. Required fields are marked *

Trackbacks and Pingbacks on this post

No trackbacks.

TrackBack URL