0

If you want to add a class for tables created using tinyMCE advanced wordpress plugin. Please see my answer.

1

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.

If you need more information use this link.

Not the answer you're looking for? Browse other questions tagged or ask your own question.