Last active
February 11, 2020 09:27
-
-
Save yuichi-e/ae85e984e36ba5264e7bc3f99f4fdf07 to your computer and use it in GitHub Desktop.
WordPressのビジュアルエディタに表(テーブル)作成機能を追加 #wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ビジュアルエディタに表(テーブル)作成機能を追加 | |
// プラグインロード | |
function mce_external_plugins_table($plugins) | |
{ | |
$plugins['table'] = '//cdn.tinymce.com/4/plugins/table/plugin.min.js'; | |
return $plugins; | |
} | |
add_filter('mce_external_plugins', 'mce_external_plugins_table'); | |
// ボタン追加 | |
function mce_buttons_table($buttons) | |
{ | |
$buttons[] = 'table'; | |
return $buttons; | |
} | |
add_filter('mce_buttons', 'mce_buttons_table'); | |
// ビジュアルエディタに文字サイズ変更機能を追加 | |
add_filter('mce_buttons', function ($buttons) { | |
array_push($buttons, 'fontsizeselect'); | |
return $buttons; | |
}); | |
// 文字サイズ指定 | |
add_filter('tiny_mce_before_init', function ($settings) { | |
$settings['fontsize_formats'] = '10px 12px 14px 16px 18px 20px 24px 28px 32px 36px 42px 48px'; | |
//$settings['fontsize_formats'] = '0.8em 1.6em 2em 3em'; | |
//$settings['fontsize_formats'] = '80% 160% 200% 300%'; | |
return $settings; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment