Adding custom styles to TinyMCE editor

Hi, I’m trying it, as can be seen in the codex, adding this line to functions.php:

add_editor_style( 'assets/css/txt-styles.css' );

And adding a css file with my own classes:

assets/css/txt-styles.css

But, nothing happens! TinyMCE editor seems do not changed. What I’m doing wrong? There is an specific way to do it in roots?

Thank you.

I found another way to add styles. It works:

So, forget this thread, please.

Use Roots’s built in editor-style.css. It gets loaded here: https://github.com/roots/roots/blob/master/lib/init.php#L35

3 Likes

How should I use it? I have one style in /assets/css/editor-style.css

Something like this:

/** These styles are used in your backend editor. **/

.style {
    background-color: black;
}

But nothing happens (there is no new dropdown menu in TinyMCE editor).

I have seen that editor-style.css is originally located at root theme dir. I dont know why, since init.php point to /assets/css/.

Your original post was not clear… I thought you simply wanted to style certain text/tags within the editor.

If you want to add custom style options as dropdown items within the TinyMCE editor then see this Codex article: http://codex.wordpress.org/TinyMCE_Custom_Styles.

2 Likes

I’m sorry. My english is very low level!

I can see that your link to codex show the same solution I found (post it in second message of this thread). This tells me that is the correct way to do it!

Thank you very much.