1

So Im using the tiny_mce_before_init filter to added a few classes to the wp_editor and am getting unexpected results. I havent used this before, but from what Im reading and what my peers tell me I should be able to apply classes to elements in the editor directly, and not creating a wrapper element.

So I have this:

 $new_styles = array(
        array(
            'title' => __( 'Custom Styles', 'title' ),
                          array(
                'title'     => __('Table Header','kjd'),
                'classes'   => 'table-header',
                'wrapper'   => true
            ),
            array(
                'title'     => __('Table Subheader','kjd'),
                'classes'   => 'table-subheader',
                'wrapper'   => true
            )....

From what I understand, both 'inline' and 'block' are optional and the 'wrapper'=>true argument will apply the class to the selected element, and not wrap it in whatever. But no matter which options I apply (like 'wrapper'=>false, or 'block' => 'td' ) work. Anyway, Im told that this funcationality changed in WP 3.9

My goal is to apply some classes to table cells so that when my client copies and pastes in a table, they can style it appropriately. They would click a cell and apply the style to said cell.

2 Answers 2

0

I don't think the wrapper should be a problem, as long as the classes of the TD-elements are unique. Did you check the CSS output using FireBug (or Chrome Developer)? The client should be able to style it, like so

.tinymce .table .table-header td {}
0

Well, this still doesn't work how I was led to believe, but I've opted for using the "selector" argument to make specific rules for my tables. so using "selector" => "td" i was able to appropriately target the table cells.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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