如何为TinyMCE高级WordPress插件的表添加表类?

时间:2018-11-16 作者:Dushan

如果您想为使用tinyMCE高级wordpress插件创建的表添加一个类。请看我的答案。

1 个回复
SO网友:Dushan

Add this code in your theme\'s functions.php file

//wp-content/themes/my-theme/functions.php
function bootstrap_classes_tinymce($settings)
{
    $styles = array(
        array(
            \'title\' => \'None\',
            \'value\' => \'\'
        ),
        array(
            \'title\' => \'Table\',
            \'value\' => \'table\',
        ),
        array(
            \'title\' => \'Striped\',
            \'value\' => \'table table-striped table-hover\',
        ),
        array(
            \'title\' => \'Bordered\',
            \'value\' => \'table table-bordered table-hover\',
        ),
    );

    $settings[\'table_class_list\'] = json_encode($styles);

    return $settings;
}

add_filter(\'tiny_mce_before_init\', \'bootstrap_classes_tinymce\');

Feel free to remove table-hover class if you don\'t need it.

如果需要更多信息,请使用此link.

结束